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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular expression question 1

Status
Not open for further replies.

JuanitaC

Programmer
Feb 21, 2001
292
CA
I have written this small regular expression, but it isn't working. I have these three characters that I use to delimit a string. Before I write the string to the screen, I want to ensure that all the delimiters are removed. I can't remove them individually, in case they appear in the string, I only want to remove when they appear together.
Code:
rExp=/|`~/g
var tmpRows = new String(outString)
outString=tmpRows.replace(rExp,"")
If I do this
Code:
rExp=/[|`~]/g
var tmpRows = new String(outString)
outString=tmpRows.replace(rExp,"")
it works, but that removes the characters individually, from what I understand on the DevGuru site.

Any ideas?
 
The first one is not correct | = OR in RegExp, if you want to use a pipe you have to escape it with a \ i.e: \| --BB
 
Thanks a bunch! I knew it would be something like that, but I couldn't find which of my characters was a special one.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top