|
|
Browse by Tags
All Tags » greediness
-
I am using Java's regular expression library.
I need to extract the common name from an active directory's distinguished name for a user. I have the String representation of a user's distinguished name. The only portion I need or care about is the common name. I am trying to write a regular expression that will extract that ...
-
I am doing parsing of html to pick up url's with url-titles from web-pages using PERL (actually I am using a Perl-script not made by me that takes url-adresses and regexps as input to produce links from the wanted site). I often get problems related to controlling matching patterns in single lines vs multiple lines. Sometimes I always ...
-
Try this pattern:
(?s)<!--\s+TemplateBeginEditable\s+name="(?<name>[^"]*)"\s+-->(?<content>.*?)<!--\s+TemplateEndEditable\s+-->
The singleline modifier (?s) is important, so that the dot character in the content subpattern matches newlines as well. Also, your pattern was too greedy and would grab ...
-
I understand that you want to match all the category names, i.e. the content of every <td></td> after an <tr>.
If I remember correctly, PHP's POSIX extended regular expressions don't know ungreedy quantifiers. I prefer Perl Compatible Regular Expressions (PCRE) anyway ...
|
|
|