CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
partial string matches

 



RobL
Deleted

Mar 6, 2001, 12:46 PM

Post #1 of 2 (1053 views)
partial string matches Can't Post

Hi

I am sure this must be a simple question, but I have search the forums and looked in a couple of books

I can do a simple search and return the results where the search string matches exactly the target string, however how do I do a partial search or a search that ignores the case.

E.g., if I search for "Zap" the results would be

The Zap
zap
the zap

Thanks

Rob





japhy
Enthusiast / Moderator

Mar 6, 2001, 1:21 PM

Post #2 of 2 (1052 views)
Re: partial string matches [In reply to] Can't Post

To do a match case-insensitively, use the /i modifier on the regex.


Code
if ("hello" =~ /HE/i) { ... }  # matches

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives