Link to home
Start Free TrialLog in
Avatar of I82Much87
I82Much87

asked on

Regular expressions in Crystal Reports 8.5

I am trying to find all fields that have specific words in them, standing by themselves.  The list of words includes
Road
Street
View
Village

I would want

132 Beach Road
to show up (Road)

but not 132 Broadside Lane (Broad != road)

What we have now is something like where field LIKE "*ROAD*" which obviously gets too many hits.  I cannot figure out how to do word boundaries in Crystal reports.  Please help

I don't think the database it is accessing is SQL, but I'm not positive.
Avatar of I82Much87
I82Much87

ASKER

if {tblStudentAddress.ADDRESS_1} like ["*Alley*","*Apartment*","*Avenue*"] then "Y"

is how the code is currently structured
Avatar of Mike McCracken
Put spaces around the word
You could do it as

if {tblStudentAddress.ADDRESS_1} like ["* Alley *", "Alley *", "* Alley", "* Apartment *","Apartment *","* Apartment","* Avenue *","Avenue *","* Avenue"] then "Y"

That should cover Alley, Apartment and Avenue at the start, middle and end

mlmcc
Yes that would work if it's in the middle of the sentence.  But it would not work for Road at the end of a line, for instance.  Similarly there are some of the words that will be the first word in the line, so they would not have a leading space
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think this will work.  You didn't mention how to get the word Road in the middle of the line by itself, but I think if we modify your pattern and say "* Road *" that will work.

Thanks!