Hi All,
I am using this regex in a program in a C# program but it is taking so much time when executed on larger data.
"<((P)|(DIV))[^>]*>\\s*(<A[^>]*>)*\\s*(<FONT[^>]*>)?\\s*(<BR>)?\\s*(<B>)?\\s*(<FONT[^>]*>)?\\s*(\\-)?\\s*((\\d\\d?\\d?)|(i+))\\s*(\\-)?\\s*(</font>)?\\s*(</p>)?\\s*(</div>)?\\s*(<P[^>]*>)?\\s*(</P>)?\\s*((<[^>]*>)|(\\s))*<hr[^>]*>"
Can any one please help me optimize this
Thanx in advance
How to optimize this REGEX
Moderator: General Moderators
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: How to optimize this REGEX
Where possibly use: non-capturing parentheses [1] and possessive quantifiers [2] or atomic grouping [3].
[1] http://www.regular-expressions.info/brackets.html
[2] http://www.regular-expressions.info/possessive.html
[3] http://www.regular-expressions.info/atomic.html
[1] http://www.regular-expressions.info/brackets.html
[2] http://www.regular-expressions.info/possessive.html
[3] http://www.regular-expressions.info/atomic.html