Regular Expressions problem 
Author Message
 Regular Expressions problem

Hi there,

    I am dealing with Regexp, onlythat I cannot set the right pattern to
help me find the right texts within a text file. I need to pattern to find
all links that are relative links. Meaning they not not start with either
"http://" or "mailto:" after the "href=".

My pattern so far is: regEx.Pattern = "<a href=.?[^(http://)|(mailto:)]"

Onlythat it doesn't seem to operate right...

Any ideas???

Thanks in advace,
David Treves



Mon, 24 Feb 2003 16:16:54 GMT  
 Regular Expressions problem



Quote:

> Hi there,

>     I am dealing with Regexp, onlythat I cannot set the right pattern to
> help me find the right texts within a text file. I need to pattern to find
> all links that are relative links. Meaning they not not start with either
> "http://" or "mailto:" after the "href=".

> My pattern so far is: regEx.Pattern = "<a href=.?[^(http://)|(mailto:)]"

> Onlythat it doesn't seem to operate right...

> Any ideas???

Try leaving the pipleline character out of the expression.
the brackest alrady indicatie an "OR" group.
The way you wrote it now, it sais "not followed by http://" OR "followed by
mailto:"
Also add something to the end of the expression to cointain the actual link.
Otherwise you would only match the "href" tag an not the characters behind
it.
It would also be a good idea to do the matching case insensitive.
Put escpa characters in front of the slashes, cause they have a special
meaning
Try this:

regEx.Pattern = "<a href=\"?[^(http:\/\/)(mailto:)].*\"?\>"

Good luck,

Maaten



Mon, 24 Feb 2003 20:46:30 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Regular Expression Problem

2. Regular Expression problem with URL

3. Regular Expression problem

4. VB Regular Expression Problem

5. Regular Expression Problems

6. a Regular Expression problem in IE5

7. regular expression problem

8. Regular Expression problem

9. Regular Expression Problem Identifying Quotes...

10. regular expressions problem

11. Regular Expression Problem

12. Regular Expression problem

 

 
Powered by phpBB® Forum Software