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

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.
Who is Participating?
"Road *"  will get Road at the front of the line like
Road A

"* Road" will get Road at the end
A Road

The only one it won't get is ROAD by itself.
To get that add "Road"

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

is how the code is currently structured
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

I82Much87Author Commented:
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
I82Much87Author Commented:
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.