[Solved] Regular Expressions:JavaScript
[ad_1] Once possible solution is the following: ” Hi @raju how do you do? “.replace(/\s+|[@\?]/g,’-‘) .replace(/–+/g,’-‘) .replace(/^[\s-]+|[\s-]+$/g,”) >> output: “Hi-raju-how-do-you-do” You can add any other ‘special’ chars to the [] in the first replace. 1 [ad_2] solved Regular Expressions:JavaScript