Regular expressions in Crystal Reports 8.5

Posted on 2009-02-10
Last Modified: 2012-05-06
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.
Question by:I82Much87

    Author Comment

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

    is how the code is currently structured
    LVL 100

    Expert Comment

    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


    Author Comment

    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
    LVL 100

    Accepted Solution

    "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"


    Author Closing Comment

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now