Jump to content

regex question find pattern and replace part of pattern


Semnomic

Recommended Posts

Hi

 

Im struggling with this problem

I have a string, in this string I have a "-" followed by 10 random digits.

 

so eg.   $mystring =  cat-345-4345645678abcd-12abc

I can find the "-4345645678" with ([-][0-9]{10})|.

 

 I need to replace the "-" with an "xx"

the "-" I'm trying to replace MUST be followed by ten random numbers.

Any ideas ?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.