Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My string like 500 - 400, i want convert into 500-400.

My find REGEX is
\b(\d+)\s-\s(\d+)\b
and my replace replace REGEX is
\b(\d+)-(\d+)\b


If i have default Replace string then i will Replace easier,but here i have dynamic Replace

string that is,depends upon given values so i struct here.

Suggest me to solve this.

Thanks in advance
Posted
Updated 24-Jul-14 21:01pm
v4

1 solution

Change your replace string to:
$1-$2
That replaces the whole matched input with the first group (the first data in brackets) followed by a hyphen, then the second match group.

If you are going to use regexes, then get a copy of Expresso [^] - it's free, and it examines and generates Regular expressions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900