Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

want to remove first and last character of any word by using regex....

 

FOr example..

 

(HELLO) (WORLD) will return === HELLO WORLD

 

and (HE/LLO) (WO/RLD) will return ====== HE/LLO WO/RLD

 

 

 

or //Hello WOrld/ will return ========= Hello WOrld

 

or (HELLO) (W/ORLD) STACKOVERFLOW) will return === HELLO W/ORLD STACKOVERFLOW

 

(He(Lo) Wo®ld will return ===== He(Lo Wo®ld

 

I dun want to replace all parenthesis ..I wish to replace First and last parenthesis of any word.....

 

I m trying this ...

 

temp = Regex.Replace(temp, @"^[!@#$%^&*()_+=[{]};:<>|./?,\'""-]+", " ");

 

BUT this regex equation ONly remove FIRSt CHaracter IF FOund....

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.   Paste as plain text instead

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