regex - Javascript replace all characters that are not a-z OR apostrophe -


i have around interwebs have yet find solid answer. seems pretty straight forward. let want replace characters in string not a-z , not , apostrophe. example:

with string "jeni's splendid ice cream" replace characters not a-z or apostrophe. have tried far is:

var term = "jeni's splendid ice cream" term.tolowercase().replace(/[^a-z]|[^\']/g, ''); 

but didn't seem work.... correct everyone? need sanity check, lol

or statements (|) belong inside group, in case unnecessary. regex should trick:

/[^a-z']/g 

working example:

var term = "jeni's splendid ice cream"  alert(term.tolowercase().replace(/[^a-z']/g, ''));


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -