美化脚本 - 正则表达式 [英] Beautification Script - Regular Expressions

查看:113
本文介绍了美化脚本 - 正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在使用Perl开发VHDL代码美化器。我来到美化过程的这一部分,我真的陷入困境。例如,假设下面的一段VHDl代码:


代码

Hi all,

I am working on a VHDL code beautifier with Perl. I''ve come to this part of the beautification process and I got really stuck. Assume for example the following piece of VHDl code:

CODE

展开 | 选择 | Wrap | 行号

推荐答案


大家好,


我正在使用Perl处理VHDL代码美化。我来到美化过程的这一部分,我真的陷入困境。例如,假设下面的一段VHDl代码:


代码
Hi all,

I am working on a VHDL code beautifier with Perl. I''ve come to this part of the beautification process and I got really stuck. Assume for example the following piece of VHDl code:

CODE
展开 | 选择 | Wrap | 行号



这可以使用 split()函数用于在文件中的每一行的逗号上拆分,然后在冒号上拆分结果数组的最后一个元素以获取最后两个字段。

知道你到目前为止尝试了什么会很好!
This can be done using a split() function to split on commas for each line in the file, then splitting the last element of the resulting array on colon to get the last two fields.
It would be good to know what you have tried so far!



是的,你是对的!对不起,我忘了提,但我已经尝试了这个:

Yes you''re right! Sorry I forgot to mention, but I''ve tried this lot already:

展开 | 选择 | Wrap | 行号


我觉得问题出在这一行:
I feel the problem lies in this line:
展开 | 选择 | Wrap | 行号


这篇关于美化脚本 - 正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆