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 And Replacing 1

Status
Not open for further replies.

webmigit

Programmer
Joined
Aug 3, 2001
Messages
2,027
Location
US
<CFIF Question contains &quot;RegEx&quot;>
Ask Tek Tips!
<CFELSE>
Do fine...
</CFIF>

I need to replace every character with itself.. and 1..

Like.. replace(string,&quot;a&quot;,&quot;a1&quot;,&quot;ALL&quot;)

Now.. I could do this... 62 times (10 digits, 26 lowercase letters, 26 uppercase letters) but that would be alot of useless code.. I'd rather just do it once...

Thanks,
Tony Hicks Did I help?
Vote!
 
can you explain a little more please? - tleish
 
If you're trying to put a &quot;1&quot; after every letter or number in a string, here's how to do it:
Code:
<cfset string2 = REReplace(string1,&quot;([A-Za-z0-9]), &quot;\11&quot;, &quot;ALL&quot;)>
The POSIX character class [[:alnum:]] is the same as [A-Za-z0-9], so you could use that also.
 
Thanks! Did I help?
Vote!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top