1

I'm using javascript replace function, but it doesn't seem to work with the apex:

myText = "This is an apex ' and this is another apex ' ";
myText.replace(/[^A-Za-z0-9]/,''));

This should skip the apex ('), but it doesn't!!

http://jsfiddle.net/GMBMt/5/

Any idea how to resolve this?

Thanks!

1 Answer 1

2

As written this will only replace a single occurrence, add a g (global) modifier:

myText.replace(/[^A-Za-z0-9]/g, ''));

This will result in:

Thisisanapexandthisisanotherapex

Here is an updated fiddle.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.