Hi all,
Consider the below code:
Dim str as string="Microsoft Corporation (MS) is the biggest company"
Dim strsym as string="MS"
str=Regex.Replace(str,"\((" & strsym & "))\","($1: about $1)")
Response.write(str)
This code will produce the output as : Microsoft Corporation (MS: about MS) is the biggest company
Suppose if i change my string like this :
Dim str as string="Microsoft Corporation (MS,MT) is the biggest company"
Dim strsym as string="MS,MT"
I want the output to be shown as Microsoft Corporation (MS: about MS,MT: about MT) is the biggest company
How can i change the regex to get this kind of output? If any one who know how to do this please send me the code...
Fernando SotoPosted Jun 8, 2008, 11:50 PM
Hi Swapna;
This code sample will do what you want.
str = "Microsoft Corporation (MS,MT) is the biggest company"
strsym = "(MS)(,)(MT)"
str = Regex.Replace(str, "\((" & strsym & ")\)", "($2: about $2$3$4: about $4)")
Response.write(str)
Fernando