Daniel
Preternatural
Registered: Apr 2002
Location: On a collision course with reality.
Posts: 334 |
Regular Expression help request
How can I use regular expressions to match for any word/string that contains an expression totally dependent upon an earlier match in the same string?
For a simplified example, I would like to match all string starting and ending with the same letter (Example string: "car noon treat boys hannah", I would like the regexp that matches against "noon", "treat", and "hanna", and capturing "n", "t", and "h").
For bonus points: I would like to take this problem further though, particularly in matching html tags:
I.e.: I would like to scan my entire html document and match against all 2-part html tags, such as "<b>BOLD TEST</b>", "<a href=whater>sometext</a>", and "<img src="image.jpg>sometext</img>", capturing "b", "a", and "img".
I don't need involved help on the second part (unless someone happens to know it offhand). I'm sure that I can extrapolate the solution to the html tag matcher by knowing the solution to the first problem I posed.
thanks!
__________________
Actually, I prefer a cold body in a warm bed.
Last edited by Daniel on 01-19-2006 at 01:40 AM
Report this post to a moderator |
IP: Logged
|