471,348 Members | 1,134 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Need help on Regex

Hi,

I need to replace all spaces in a square bracket with understores.
Does anybody know the regular expression to do that? For example,
[Employee First Name] will become [Employee_First_Name].

Thanks in advance!!

Jan 19 '06 #1
1 910
sm*********@gmail.com wrote:
I need to replace all spaces in a square bracket with understores.
Does anybody know the regular expression to do that? For example,
[Employee First Name] will become [Employee_First_Name].


Probably the easiest approach is to match on

\[([^]]*)\]

and then use the Replace method (that takes a MatchEvaluator delegate)
to replace all blanks in the match text.

--
<http://www.midnightbeach.com>
Jan 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Michael R. Pierotti | last post: by
1 post views Thread by hillcountry74 | last post: by
9 posts views Thread by jmchadha | last post: by
6 posts views Thread by Extremest | last post: by
7 posts views Thread by Extremest | last post: by
3 posts views Thread by aspineux | last post: by
15 posts views Thread by morleyc | last post: by
3 posts views Thread by =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post: by
4 posts views Thread by Danny Ni | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.