#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    toronto, ontario, canada
    Posts
    10
    Rep Power
    0
    Lets say I have a sentence, $sentence. To check if $sentence has the the line "In this world", what's the regular expression?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    if($sentence =~ /In this world/) {
    #do this
    }

    To replace words, you use this:

    $sentence =~ s/old words/new words/ig;

    Only use the 'i' in the end if you want it to be case insensitive.

IMN logo majestic logo threadwatch logo seochat tools logo