Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Apostrophes

  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Apostrophes

    I'm trying to fix some "broken strings"... I have a few strings in a database that are missing apostrophes (and instead have a space). Example:

    "I wonder how Bill s mom will react?"

    I'm trying to find a way to insert the apostrophe where it should be, for example:

    "I wonder how Bill's mom will react?"

    This is what I have code wise:
    Code:
    if($w =~ m/(\S) s(\W)/) {
      $w =~ s/\S s\W/$1's$2/gi;
    }
    But it's not quite working. Instead I'm getting results like this:

    "I wonder how Bill'smom will react?"

    It's probably something quite simple, but I'm not getting why the space isn't getting added back in?

    Your thoughts?

  • #2
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Alright guys, I posted the same question over on Google+, and got this response:

    Code:
    $w =~ s/(\S) s(\W)/$1's$2/gi;
    That seems to do the trick.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •