473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

detect samepattern

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(@"^(\**)$");
then Ismatch() to check it

but this is incorrect, could you help me ? i am very new to C# please
help me

Thanks

Nov 6 '06 #1
1 1246
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
Nov 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: R. Rajesh Jeba Anbiah | last post by:
Here is a nice code to detect utf-8 <http://in2.php.net/utf8_encode#39986> But, I couldn't find out the logic behind the script. If anyone knows that please share. Particularly I would like to...
23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
23
by: Michel Bany | last post by:
I am trying to parse responseXML from an HTTP request. var doc = request.responseXML; var elements = doc.getElementsByTagName("*"); the last statement returns an empty collection when running from...
10
by: Ben Xia | last post by:
Is there some way can detect MAC address with PHP? any help will be appreciate. Ben
6
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank you hb
12
by: Patrick Dugan | last post by:
I have an vb.net application that is a module that uses a "application.run" in the sub main to start. There is no form involved (just a system tray icon) How can you detect when the application...
4
by: Chris Johnson | last post by:
Hey all, I have a small app I have developed that periodically pings a list of server and returns their status. Given my environment I have setup the program such that a server can be down 4...
1
by: mjobbe | last post by:
Hi, I'm creating an MSI for a client app using a Visual Studio Setup Project. I'm trying to detect if Internet Explorer is running on the target computer before I start the installation. How do I...
4
by: goscottie | last post by:
I used submodal as my popup window. With some tweaks, it working great in my app. However, I can't find a way to detect session timeout in the popup window. The app is a form based...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.