Searching a string for a paticular pattern.
Posted on 2004-09-17
I am writing a method that checked a passed string for a number of patterns, which if detected returns false..
The first method work fine, which checks the start of the string, but when I need to search within the string it fails.
//we dont want email addresses so look for email links:
//this recognises email addresses:
//This method doesn't work
if(link.indexOf("related-author-search") != -1)
So the second method tries to detect whether the pattern "related-author-search" appears in the passed string, but my program never detects this.
Can anyone offer any insight