需要帮助Regex Patterns [英] Need help with Regex Patterns
问题描述
我正在使用visual c#制作一个HTML编辑器。但我需要一个正则表达式模式来寻找代码折叠的html标签(<>和<(斜杠)>)。那些<>之间可能有任何东西。我正在使用Pavel Torgashov的名为 FastColoredTextBox 的文本框控件。
在我的位置 9:45 。我感冒了,脑袋疼痛。 快速回复将非常感谢。在此先感谢。
-TheKingofdemon33
I'm making an HTML editor in visual c#. But i need a regular expression pattern for finding html tags( "<>" and "<(slash)>") for code folding. There could be anything between those "<>". I'm using a textbox control called FastColoredTextBox by Pavel Torgashov.
It's 9:45 in my place. I'm having cold and my heads paining. Fast reply would be very much appreciated. Thanks in advance.
-TheKingofdemon33
推荐答案
虽然您已经解决了问题,但我发布此信息是为了帮助那些想要更好地使用RegEx的人。一个非常有用的网站是 regexlib [ ^ ];他们有一个庞大的正则表达式库。他们还有一个 RegEx测试人员 [ ^ ]。此外,此处还提供了一个非常有用的RegEx工具。
Although you have solved your problem I am posting this to help those wanting to better use RegEx. A very helpful site is regexlib[^]; they have a large library of Regular Expressions. They also have a RegEx tester[^]. Also a very useful RegEx tool is available here.
试试这个正则表达式:
Try this regex:
<(.+?)>
如果你想要两个正则表达式,那么这是第一个,用于查找< tag>
If you want two regexes, then this is the first one, for finding <tag>
<[^/>]+>
这是第二个,用于查找< / tag>
And this is the second one, for finding </tag>
<\s*/[^>]+>
我解决了这个问题。
我使用了内置的HTML荧光笔,并重写了我需要的单词的突出显示。它默认具有代码折叠功能;
I Solved this Question.
I used the in-built HTML highlighter and put an override for the highlighting of the words i needed. It had the code folding by default;
这篇关于需要帮助Regex Patterns的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!