472,129 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Search colon

Hi: How to i search ":" in a sentence. For eg:
abc efg hij : kkk ddd lll
fda fdasf jfdas fdas fsad

When i read a line i want to skip those lines where ":" is present

data = ts.ReadLine

Aug 10 '06 #1
4 1182
"Eric" <eh******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Hi: How to i search ":" in a sentence. For eg:
abc efg hij : kkk ddd lll
fda fdasf jfdas fdas fsad

When i read a line i want to skip those lines where ":" is present

data = ts.ReadLine
If InStr(data,":") = 0 Then
' do your thing
End If
Aug 10 '06 #2

Eric wrote:
Hi: How to i search ":" in a sentence. For eg:
abc efg hij : kkk ddd lll
fda fdasf jfdas fdas fsad

When i read a line i want to skip those lines where ":" is present

data = ts.ReadLine
Consider using Regular Expressions - in my experience they're much
faster and easier than loops which perform string comparisons --
because you can return an entire matching file in one line of code --
but are tricky to get the hang of.

This site is a good place to start:
http://www.regular-expressions.info/index.html
http://www.regular-expressions.info/completelines.html

This site describes how to use them in ASP:
http://www.4guysfromrolla.com/webtech/090199-1.shtml

And finally this actual expression should match your original problem,
assuming you're using a text file:
^.*:.*$

This looks I just fell on the keyboard, but what it means is:
^.* = a series of 0 or more characters starting at the begining of
the line
: = your search condition, the colon in this case
..*$ = another series of 0 or more characters until the end of the line

Aug 10 '06 #3
Eric wrote:
Hi: How to i search ":" in a sentence. For eg:
abc efg hij : kkk ddd lll
fda fdasf jfdas fdas fsad

When i read a line i want to skip those lines where ":" is present

data = ts.ReadLine
You need the vbscript documentation. You can download it from here:
http://tinyurl.com/7rk6

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 10 '06 #4
Bobbo wrote:
>When i read a line i want to skip those lines where ":" is present

data = ts.ReadLine
...
And finally this actual expression should match your original
problem, assuming you're using a text file:
^.*:.*$
To take Bobbo's suggestion a bit further, you already know you have a single
line, so you can simply use : as your expression:

In JScript,
if (!/:/.test(data)) { do something }

In VBScript,
Set re = New RegExp
re.pattern = ":"
...
data = ts.ReadLine
If Not re.Test(data) Then
{ do something }
End If

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Aug 10 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Cindy Mueller | last post: by
reply views Thread by Maurice Mclain | last post: by
reply views Thread by Lola Ervin | last post: by
reply views Thread by Carl Frey | last post: by
4 posts views Thread by Henry Jordon | last post: by
2 posts views Thread by Eric | last post: by
2 posts views Thread by Eric | last post: by
10 posts views Thread by B. Williams | last post: by
161 posts views Thread by Dan Lenski | last post: by

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.