Regular Expression Syntax Help
Submitted by Thursday, 27 January, 2005 - 21:39
on
I have the following on 3 separate lines in many, many files. So, I want to Search and Replace with regular expressions. Here are the lines:
< td >< img src="/theme/images/mainmenu-left-off.gif" alt="[" >< /td >
< td background="/theme/images/mainmenu-background-off.gif" >< span class="menu_lower" >< a href="/foo//links/" >Bar< /a >< /span >< /td >
< td >< img src="/theme/images/mainmenu-right-off.gif" alt="]" >< /td >
My regular expression can't find the above, and I don't understand why, any suggestions:
\s*\S*< td >< img src="/theme/images/mainmenu-left-off.gif" alt="[" >< /td >\r*\n*\s*\S*< td background="/theme/images/mainmenu-background-off.gif" >< span class="menu_lower" >< a href="foo" >Bar< /a >< /span >< /td >\r*\n*\s*\S*< td >< img src="/theme/images/mainmenu-right-off.gif" alt="]" >< /td >
Thank you. Sorry, the above code looks dirty. I tried < code > and < ? php > here so it would cleanly post, but those input formats are not available. I had to add a space after every < and before every > . This message is difficult to read .
< td >< img src="/theme/images/mainmenu-left-off.gif" alt="[" >< /td >
< td background="/theme/images/mainmenu-background-off.gif" >< span class="menu_lower" >< a href="/foo//links/" >Bar< /a >< /span >< /td >
< td >< img src="/theme/images/mainmenu-right-off.gif" alt="]" >< /td >
My regular expression can't find the above, and I don't understand why, any suggestions:
\s*\S*< td >< img src="/theme/images/mainmenu-left-off.gif" alt="[" >< /td >\r*\n*\s*\S*< td background="/theme/images/mainmenu-background-off.gif" >< span class="menu_lower" >< a href="foo" >Bar< /a >< /span >< /td >\r*\n*\s*\S*< td >< img src="/theme/images/mainmenu-right-off.gif" alt="]" >< /td >
Thank you. Sorry, the above code looks dirty. I tried < code > and < ? php > here so it would cleanly post, but those input formats are not available. I had to add a space after every < and before every > . This message is difficult to read .