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
https://forums.phpfreaks.com/topic/116966-solved-regex-for-replacing-underscores/
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 !@#$%^&*()-+={[}]|\;;"'<,>.?/

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.