.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Regular expression for splitting string

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :WPF


i have a string like this 


i want to split like this





pls help me 

thanks in advance

Regards, Anoop

View Complete Post

More Related Resource Links

How to read string end with question mark in regular expression?

Hello, I'm facing problem when I read string which is ended by question mark. I use in my code as the following. \"?(?<myfield>[^\"]?.*[^\"?]?)\"? If string is ended by question mark, it's not working. Please help me to solve my problem. Thanks. Co Coe

Regular Expression for looking for Colons (:) in a string

Hi I am really struggling with this! Using the regular expression validator I created an expression, thus "\:" to show an error message if the user tries to enter in a name that contains a colon. What I am getting is the error message showing even when there is no colon (:) in the string. What am I doing wrong? Thanks    

Regular expression - exclude certain string

Hi all,I have the following regular expression replacement:<add key="^/([^/]*)\.aspx\?" value="/default.aspx?pagename=$1&"/>What this is used for is URL re-writing, i.e. if a page comes in with the path "/test.aspx", it goes to the actual path which is "/default.aspx?pagename=test"This works fine, but it catches all page names. I would like to exclude a particular page name so it is not rewritten, for example if the page was called "exclude.aspx" it would not rewrite to "/default.aspx?pagename=exclude" but stay as "exclude.aspx".How do I modify ^/([^/]*)\.aspx\?so it excludes a certain page name?Thanks!

how does the string validation work for this regular expression?

 _strInt = value.ToString();
Regex objPattern = new Regex("[^ a-zA-Z]" ); if (objPattern.IsMatch(_strInt)) { return   new ValidationResult(true , null );
   } else return new ValidationResult(false , "Value must contain only alphabets" ); } }

if i pass a valid expression as "abc" .. its Failing .
Can some1 explaing how it's failing .

How to use Regular Expression to find a particular pattern and its index in the string??



I need some help here. I have a document containing some string like the following:


Now what I need is that I need to extract this "BusinessGoal" which as you can see, is 32 characters ahead after "-" (hyphen) and change it's case to uppercase.

The real challange is that, This "BusinessGoal" should only be replaced only and only where there is "Ref-<any 32 characters>" before it and not all. So if I find something like TypeName = "BusinessGoal"  it will be simply ignored.

So how am I going to make that reg Ex. I think it would be a combination of Regex and String Api. 

Kindly help me out.

Thanks and regards



Fahad Ali Shaikh

replace tab in the string using regular expression

      I want to replace tab space with "|" in the string using regular expressions.
I have tried for

Dim strTabString AS string = "A             B             C "                 
TextBox1.Text = Regex.Replace(strTabString , "\t", "|")
But i m not getting the results.


Regular expression: String start with
end with
which ever comes first


Regular expression is hard. Can anyone help me with this one?

I need to get XYZ 123 and abc 134

from this html code below:


<div>XYZ 123<br />

<div>abc 134</div>


 Thank you in advance!

regular expression thar allow except ".aspx" this string


hi i am new in regular expression

can anybody understood me how can i make a regular expression that

allow all the mismatch case  and don't a match case

ex: ".aspx"

( when i put any thing in text box it allow ----a ,ab ,adn.jpg ) result=true

(but when i put =.aspx ) result= false  

Regular Expression Match Exact String


I'm looking for a regular expression that satisfies one of the two conditions (Reg Expression OR Exact String Match W/ Underscores) listed below.





Thanks in advance

Security Briefs: Regular Expression Denial of Service Attacks and Defenses


Microsoft security expert Bryan Sullivan believes denial-of-service blackmail attacks will become more common as privilege escalation attacks become more difficult to execute. He demonstrates how to protect your apps against regular expression DoS threats.

Bryan Sullivan

MSDN Magazine May 2010

Help with regular expression


I am using this regular expression: /.*-lyrics-.*$

and I need the expression find urls like this:

and it do really does that!

The problem is that it finds also this URL:

Whar regular expression should I use to exclude urls that end with /lyrics ?

Thanks :]



Need regular expresion for this string


Hi All,

I would be grateful if some one can provide me regular expression for extracting just  myhomepage from below url:


Thanks in advance for replying(as always).

With Warm Regards,


Regular Expression to Match


Here is the kind of text I want to match via a regular Expression

The id="dgSchedule" is always present in the TAG but its location may differ

The table is span over multiple line/contains white spaces/tabs...

I have the regular expression to match the start and end tag respectively over a single line

\<table .*\>


The problem is to match the whole table span over multiple lines

<table cellspacing="0" rules="all" border="1" id="dgSchedule" style="border-style:None;height:100%;width:100%;border-collapse:collapse;">
	<tr class="blackbar" align="center" style="background-color:#7FB4DE;font-family:Verdana;font-weight:bold;height:20px;">
		<td>From Place</td><td>To Place</td><td>Time</td><td>Bus Type</td>

	</tr><tr style="background-color:#DEECF5;">
	</tr><tr style="background-color:#EFF5FA;">
	</tr><tr style="background-color:#DEECF5;">


Need a regular expression


I have a required field validator for a texbox, but I just found out that the texbox can have a space in it (for a delimiter, let's say).

I checked the .net and regexlib.com, but couldn't find what I was looking for.

I simply need a regular expression that basically excepts any character string including spaces in it or even a space by itself

Can someone help me out?

regular expression

hi...can anobody help me that how to write regular expression for textbox..such as the textbox should accept only numbers otherwise alert msg should be displayed ..displaying that u cannot enter the charcter in the textbox..i want this in javascritp.. 

Matching set of characters via regular expression

I need to be able to match sets of quote and space characters in a string and replace these accordingly. I currently have this done in 2 lines of code, but would like to use regular expression so that I can use only 1 line of code. See below: var Qt = unescape("%22"); //quote char var Sp = unescape("%20"); //space var Cr = unescape("%0d"); //carriage return var Lf = unescape("%0a"); //line feed var CrLf = Cr + Lf;  //carriage return & line feed stringOut = stringIn.replace(Qt+Qt+Sp+Qt,Qt+Qt+CrLf+Qt); stringOut = stringOut.replace(Qt+Qt+Sp+Qt+Qt,Qt+Qt+CrLf+Qt+Qt);   I want to replace space in string like in pattern below with carriage return line feed: (in hex) 22 22 20 22 or 22 22 20 22 22. This needs to return 22 22 0D 0A 22 or 22 22 0D 0A 22 22   Line in green above will only match and replace 22 22 20 22 , but I want have regular expression into 1 line of code which  will match and replace either 22 22 20 22 or 22 22 20 22 22  

Regular Expression for Digits, comma & space combination

Hi Can you suggest a Regular Expression for the following category. A text box which should contain: Max size : 53 0-9 digits + a comma + a space The 0-9 numbers should be repeated 5 times and separated by a comma and a space Eg: 123456789, 123456789, 123456789, 123456789, 123456789 Thanks, David.      
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend