So how do I take a string, and replace every occurrence of * with A-Za-z0-9]*
If I do not escape it, it is read as a meta character.
If I do escape it, it tells me it is an illegal use of an escape character.

Thanks

eileen keeney

Ranch Hand

Posts: 56

1

posted 9 years ago

I found the answer in another forum,
So in case anyone else stumbles on this doing a search, the answer is to use double escape characters.

The reason is that the String literal turns the \\ into a single \ before it analyses the regular expression so you get a proper \*. You will occasionally have to use \\\\ in regular expressions, or even \\\\\\\\