.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

Split a string matching the following pattern

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



I would like to match a string that starts with RFF+ folllowed by 2 or 3 characters and followed by colon(:).

For instance accepted values are :











View Complete Post

More Related Resource Links

string.Split - not all characters allowed as separator



I am working on a site where I use the Split function on a string.

To make sure I used a separator character that I do not use anywhere in the data I selected the character '£'.

This worked fine in Firefox and Safari, but in IE8 I get an 'Index out of range' error, so apparently the '£' character is not handled correctly.

I changed the separator to ';', and then it works fine.



SQL Server 2005: Regular Expressions Make Pattern Matching And Data Extraction Easier


Now you can perform efficient, sophisticated text analysis using regular expressions in SQL Server 2005.

David Banister

MSDN Magazine February 2007

How to split string?


I have a string that looks like this: pic1*pic2*pic3*

I want to take out every pic from the string like this:


I got the first pic but how do i get the other two?

Dim line as string = "pic1*pic2*pic3*"
Dim pic1 As String
Dim pic2 As String
Dim pic3 As String

pic1 = line.Substring(0, line.IndexOf("*"))
pic2 = ?
pic3 = ?

Split string using Regex with escape sequences

What is the regex to split a string using the delimiter ';', but not split on '\;' ? Backslash would be my escape character in my split string, so finding '\;' would not split, but '\\;' would split. For example I want a regex that would split the following:     "aaa;bb;cccc\;dd\;eee\\;ff\\;ggg\\\;hhh" into the following string array:     aaa     bb     ccc\;dd\;eee\\     ff\\     ggg\\\;hhh   Thanks!   -Sylvain

How to split the string value ?

 Hi I  have a string value ie) = '1001010' I want to split one word by one word. like  as 1 0 0 1 0 please guide me.  

remove pattern from string as seperate column

Hey  Everyone This seems like it shouldn't be too difficult but I'm strapped for time- I have a column where the data looks like CN=kmcde,OU=People,DC=ad,DC=FLA,DC=edu I want to pull out the 'kmcde' as a new column. I'm thinking some combination of substring and perhaps patindex but can't get it to work correctly Thanks kam

Call specific web service method by matching string value to method name?

I am getting a value in string format.  Then, I call a web service and try to dynamically call the method that corresponds to the string's value.  It doesn't work.  Any ideas?              Dim methodname As String = "getquotes"                 Dim track As localhost.Tracker = New localhost.Tracker()                 'the below line is where it fails                 track.methodname(parameter)               

Split a String from a listbox to enter data in a table


Currently, I have a listbox that the selected items are inserted into the database by a string. Now I need to add a new feature that the searches are suppose to be postback individually so the selected values from the listbox need to be inserted into the database individually so the search can work. Is it possible to split an string into separate variables or into an array?

Thanks for your help,



Following is my store procedure and my back code:

<script runat="server">
    Protected Sub insertcompanydata_click1(ByVal sender As Object, ByVal e As EventArgs)

        Dim tobresults2 As String        
        Dim li As ListItem
        Dim myArrayList As ArrayList = New ArrayList()
        Dim strarr() As String
        For Each li In txttoblb.Items
            If li.Selected = True Then
            End If

        strarr = myArrayList.ToArray(Type.GetType("System.String"))
        tobresults2 = String.Join(",  ", strarr)

        Dim txtloblb1 As String
        Dim lin As ListItem
        Dim myArrayList1 As ArrayList = New ArrayList()
        Dim strarr1() As String

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

Split string


hi all

i want to spilt 115:USD:LKR this string from oracle script. return value should be 115.

pls provide me sql script


Split string after word


Hi everybody,

How can I split a string from some word.

string test = "Hellow world one two three";

I would lile to get the string part after the word world?? The result will be after splitting the string: "one two three"

split string sql server 2005



I have a table called SubjectRank that provides subject and it's ranking.

I have a string that can be in any format. It can be 'hello cat, how -are you lion?' or 'yes horse'. In short it can be received in any manner and i have no control on how user sends the string.

What I need to do is check if the string contains any words in the subject column. If yes I need to return that word.

In addition if the string contains more than one subject from the table than I must check the ranking and return the value with the highest ranking. (1 lowest) So if the string contains 'hello cat, how -are you lion?' the sp must return the word lion.


How can I achieve this?




String.Split with with tab as separator


I should read the substrings of this file:

1	1	-1738.20118241	6787.03549108	
2	2	-1803.20118241	6759.73549108	
3	3	-2193.20118241	6759.73549108	

I haved used the tab control "\t" as the separator (there is a tab character between the columns):

      Dim separator() As String = {"\t"}
      Console.WriteLine("separator(0) = {0}", separator(0))
        ' Open the file to read from.
        Using sr As StreamReader = File.OpenText(nomeFile)
          Do While sr.Peek() >= 0
            'Dim line As New StringBuilder
            Dim stringline As String
            Dim stringarray As String()
            Dim x, y, canale 

need help in pattern matching


I have below XML schema which prompt me error when my <Attachment> node has null values,

I need validation that attachment value should must have a period (.) sign and there should be some varchar text on both side of period.

ex, file1.doc, file2.pdf, file3.jpeg, etc....  Please help


Below the schema,

N'<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="Test">
				<xs:element name="Attachment" type="NoneEmptyVals" />
	<xs:simpleType name="NoneEmptyVals">
	<xs:restriction base="xs:string">
	<xs:minLength value="1" />


and here I check XML,

Split String on underscore



I have a long string and i want to split it on the bases of case change and underscore. here is the following pattern that split on the case change but i also want to split it on the underscore. Can somebody help me out.

private static final String DIVIDER_PATTERN =  "(?<=[^\\p{Upper}])(?=\\p{Upper})"  + "|(?<=[\\p{Lower}])(?=\\d)";

 this pattern split "MyFamilyNameIsFar" to "My Family Name Is Far" but i also want to split if there is underscore. like

"MyFamily_NameIs_Far" to  "My Family Name Is Far"

Can somebody tell me which modification i need in this pattern to handle these kind of situation.


your help would be appreciated.


With Best Regards

Matching every third word in a comma delimited string.


Hello all,

I have to write a .NET program that accepts a string of comma delimited values.  I want to write a regular expression to accept every third value (starting with the sixth).  I have a regex to skip the first three values and return groups of three:


Now I need something to skip the first two words within each group.  Any suggestions?

Thanks in advance

Matching C# methods with a pattern finding the Public, Private, etc modifiers and balancing the curl


Hello all,

For a large conversion project, we need to match certain key words within C# methods and remove the entire method if found. I know .Net has a feature that allows balanced matching on the curly braces, but I am not sure how to implement it.

In a two step process, you could match the modifiers Public, Private, etc and their balanced curly braces to identify the methods and then remove those that contained the key words. In a one step process, I think you could use a positive lookahead for the key words as well.

Could someone help me with the pattern that has the balanced curly brace logic with the modifiers to identify the methods? Thanks in advance for any ideas and/or suggestions.


Have a great day!
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