Jump to content

[SOLVED] regex for replacing underscores


xnowandtheworldx

Recommended Posts

Basically, I have a script where it takes a users input, and will replace !@#$% etc. etc. with an _. Now I need a regex expression that will remove all the extra _'s say for instance....

 

!hello*#world(*! would then be turned into "_hello__world___", now what I need to do is take that output and turn it into hello_world. Is there any possible way to do this with regex? I suck with regex, so any help would be nice! Thanks for any future help some of you may provide.

Link to comment
Share on other sites

Even if I did that expression wouldn't i still have to remove the extra underscores? basically, what i needed was a regex command that would remove the _'s from the beginning and the end, and any double _'s there may be. Plus I don't know how to do a regex command for all the symbols...i need it for symbols !@#$%^&*()-+={[}]|\;;"'<,>.?/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.