By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,154 Members | 2,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,154 IT Pros & Developers. It's quick & easy.

Need regular expression for this

P: n/a
I am trying to do a regular expression to search for

a url
so anything that has http:\\www.hellothere.com
but may not have the http:\\
and may not have the www
and may not have http:\\www
and should work for upper and lower case

I tried this:
[www|WWW][a-zA-Z0-9]*[.com|.COM]"

LOL - don't laugh.

am I close?

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
1. i think access, in general is not case sensitive (unless you do a binary
search)
2. it is http:// not http:\\
3. i would use the dots as an identifier together with the instr (instring
function, see help) - you need to have at least one dot and no spaces to
have a valid IP address (e.g. bmx.com)
4. try to change your input format so that all ip addresses are entered
identical or update data that has been imported to http://...... as you say,
not all of them start with www.

nicolaas

"Danny" <da********@hotmail.com> wrote in message
news:2J**********************@news4.srv.hcvlny.cv. net...
I am trying to do a regular expression to search for

a url
so anything that has http:\\www.hellothere.com
but may not have the http:\\
and may not have the www
and may not have http:\\www
and should work for upper and lower case

I tried this:
[www|WWW][a-zA-Z0-9]*[.com|.COM]"

LOL - don't laugh.

am I close?

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
Nov 13 '05 #2

P: n/a
thanks for your response.
I don't see how to use the . as a placeholder in the instr command in access
2002.
I am using regular expression module and almost have this working but not
quite.

Can you tell me how to do this with the . as a place holder?

Thanks

"WindAndWaves" <ac****@ngaru.com> wrote in message
news:Fx*******************@news.xtra.co.nz...
1. i think access, in general is not case sensitive (unless you do a binary search)
2. it is http:// not http:\\
3. i would use the dots as an identifier together with the instr (instring
function, see help) - you need to have at least one dot and no spaces to
have a valid IP address (e.g. bmx.com)
4. try to change your input format so that all ip addresses are entered
identical or update data that has been imported to http://...... as you say, not all of them start with www.

nicolaas

"Danny" <da********@hotmail.com> wrote in message
news:2J**********************@news4.srv.hcvlny.cv. net...
I am trying to do a regular expression to search for

a url
so anything that has http:\\www.hellothere.com
but may not have the http:\\
and may not have the www
and may not have http:\\www
and should work for upper and lower case

I tried this:
[www|WWW][a-zA-Z0-9]*[.com|.COM]"

LOL - don't laugh.

am I close?


---
Please immediately let us know (by phone or return email) if (a) this

email contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004

Nov 13 '05 #3

P: n/a
not sure, this is not my strength. I would write a module like this:
Function CHL(S As String) As Boolean
Dim i As Integer 'location of string searched, = 0 if not found
'---search for prerequsites: space or dot---
If InStr(1, S, " ", vbTextCompare) Then GoTo xit ' search for space
If InStr(1, S, ".", vbTextCompare) > 1 Then
'-----search for any of the following, add/delete lines as and required
i = i + InStr(1, S, "www", vbTextCompare)
i = i + InStr(1, S, "http://", vbTextCompare)
i = i + InStr(1, S, "com", vbTextCompare)
i = i + InStr(1, S, "net", vbTextCompare)
i = i + InStr(1, S, "org", vbTextCompare)
'if any of the following were found then it is a hyperlink
If i > 0 Then CHL = True
End If
xit:
Exit Function
err:
CHL = False
Resume xit
End Function

(just copy and paste this text into a new module)

you can then use the following expression for the controlsource of a field
in a form (just an example):

="The value for field X " iif(CHL([X])=true, "contains a hyperlink", "does
not contain a hyperlink")

Let me know if this does not make sense!


"Danny" <da********@hotmail.com> wrote in message
news:7L**********************@news4.srv.hcvlny.cv. net...
thanks for your response.
I don't see how to use the . as a placeholder in the instr command in access 2002.
I am using regular expression module and almost have this working but not
quite.

Can you tell me how to do this with the . as a place holder?

Thanks

"WindAndWaves" <ac****@ngaru.com> wrote in message
news:Fx*******************@news.xtra.co.nz...
1. i think access, in general is not case sensitive (unless you do a

binary
search)
2. it is http:// not http:\\
3. i would use the dots as an identifier together with the instr (instring function, see help) - you need to have at least one dot and no spaces to
have a valid IP address (e.g. bmx.com)
4. try to change your input format so that all ip addresses are entered
identical or update data that has been imported to http://...... as you

say,
not all of them start with www.

nicolaas

"Danny" <da********@hotmail.com> wrote in message
news:2J**********************@news4.srv.hcvlny.cv. net...
I am trying to do a regular expression to search for

a url
so anything that has http:\\www.hellothere.com
but may not have the http:\\
and may not have the www
and may not have http:\\www
and should work for upper and lower case

I tried this:
[www|WWW][a-zA-Z0-9]*[.com|.COM]"

LOL - don't laugh.

am I close?

---
Please immediately let us know (by phone or return email) if (a) this

email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004


---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.