NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
regex search and replace with backreferences


Joined: 06 Oct 2003
Posts: 13
Reply with quote
am i mistaken in saying that the Regular Expression Replace feature does not support backreferences? (using version 3.3.1 on windows)

what i mean is, i would like to replace this pattern:
<(p|hr|div|span)/>

with this:
<\1 class="fooClass"/>

in english that would be, or is supposed to be, "find all p, hr, div, and span tags that do not have any attributes, and are self-closed tags, and add the class="fooClass" attribute."

if i use Regular Expression Find, and search for (for example) <[a-z]+/> this works fine. i can use that same pattern in Replace. but adding parentheses causes no matches to be found. does phpEd use a different syntax to specify subpatterns and backreferences? (i guess what I mean by different is, different from Perl.)
View user's profileFind all posts by nebySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
Yet, phped does not support this.
Hopefully, in a new version it will work much more conveniently.


Last edited by dmitri on Wed May 19, 2004 4:42 pm; edited 1 time in total
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 06 Oct 2003
Posts: 13
Reply with quote
thanks for the reply
View user's profileFind all posts by nebySend private message
regex search and replace with backreferences
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic