| View previous topic :: View next topic |
| Author |
Message |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Wed May 20, 2009 9:34 am Post subject: RegEx Search |
|
|
I would like to do an RegEx Search and it is proberbly easy but I just can't find out how to. Can someone help me or point me into the right direction?
This is the match : "<p" followed by anything and finnished by "</p>"
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
DanielG Expert Cheater
Reputation: 1
Joined: 13 May 2009 Posts: 130 Location: The Netherlands
|
Posted: Wed May 20, 2009 12:44 pm Post subject: |
|
|
At Regexpal(.)com you can try your regexp skills.
And at regular-expressions.info/examples(.)html you have "Grabbing HTML Tags" with an example very close to your wishes:
| Quote: | <TAG\b[^>]*>(.*?)</TAG> Analyze this regular expression with RegexBuddy matches the opening and closing pair of a specific HTML tag. Anything between the tags is captured into the first backreference. The question mark in the regex makes the star lazy, to make sure it stops before the first closing tag rather than before the last, like a greedy star would do. This regex will not properly match tags nested inside themselves, like in <TAG>one<TAG>two</TAG>one</TAG>.
<([A-Z][A-Z0-9]*)\b[^>]*>(.*?)</\1> Analyze this regular expression with RegexBuddy will match the opening and closing pair of any HTML tag. Be sure to turn off case sensitivity. The key in this solution is the use of the backreference \1 in the regex. Anything between the tags is captured into the second backreference. This solution will also not match tags nested in themselves. |
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Wed May 20, 2009 1:25 pm Post subject: |
|
|
<p>.*</p>
that worked in at the regex tester.
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Wed May 20, 2009 1:27 pm Post subject: |
|
|
Here is a good place to start : The 30 minute Regex tutorial.
Example which I think should do what you require:
Tested with Expresso.
_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren |
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Wed May 20, 2009 1:46 pm Post subject: |
|
|
Thanks for all the replies however I can't do (?<=exp). How would I do that? It supposed to selected the text after exp.
_________________
Intel over amd yes. |
|
| Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Wed May 20, 2009 5:25 pm Post subject: |
|
|
what regex matcher are you using
VB6? Vb.NET? C#? C++/Boost? Javascript? Java? PHP?
I use VB6.. and the default settings are very wrong it only matches the first match in VB6.. so these are the settings I use to match all..
I'd use IgnoreCase for <p> and <P> small and big tags.
| Code: |
Set myRegExp = New RegExp
myRegExp.MultiLine = False
myRegExp.IgnoreCase = True
myRegExp.Global = True
|
_________________
|
|
| Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Thu May 21, 2009 1:39 am Post subject: |
|
|
i like doing things the old way with a bunch of nested loops.
confusing, but i get it.
_________________
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
|
| Back to top |
|
 |
|