Fyne wrote:
I have a lot of string data, I want to know if data_i is subtring of
data_{i+1}
a simple case, data1=atcgat*gatta, data2=atcgat*tsgatgat, they both
separated by an asterisk
I did
Regex separator=new Regex(@"^(\**)$");
That regex matches a line containing zero or more asterisks
Something like this
Regex separator=new Regex(@"^.*\*.*$");
will match an optional substring, one asterisk and another optional
substring, i.e. any string containing an asterisk. However, if the string
contains more than one asterisk, it will (probably) match on the last
asterisk.
You can tighten this up a bit:
Regex separator=new Regex(@"^[^\*]*\*[^\*]*$");
This will match a string that contains exactly one asterisk, optionally
surrounded by non-asterisk characters.
but this is incorrect, could you help me ? i am very new to C#
Hmm, I think it's more like you're new to regular expressions. Take a look
at Regex Coach at
http://weitz.de/regex-coach/
Ebbe