Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex...

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hi. How would you make all occurences within a regex search be changed?

I'm using;

$thing =~ s/0/<img border=\&quot;0\&quot; src=\&quot;0\.gif\&quot;>/;

at the moment, but it only changes the first occurence of that number, and not the rest. Is there something I need to put after the last / ?

Thanks

Andy
 
Just as you suspected, you need to add the global (all occurrences) matching operator 'g'.

$thing =~ s/0/<img border=\&quot;0\&quot; src=\&quot;0\.gif\&quot;>/g;
 
Status
Not open for further replies.

Similar threads

Replies
2
Views
352
  • Locked
  • Question Question
Replies
4
Views
481
  • Locked
  • Question Question
Replies
1
Views
326
  • Locked
  • Question Question
Replies
5
Views
479

Part and Inventory Search

Sponsor

Back
Top