Results 1 to 4 of 4

Thread: RegExp to turn "someString" into "some String"?

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default RegExp to turn "someString" into "some String"?

    Hi all,

    I'm looking for a RegExp that I can use to transform a string like the one in the topic title.

    I need to search for a lowercase character followed by an uppercase character, then insert a space between those two characters.

    Any tips greatly appreciated! I am still very green when it comes to regexps.
    My site: FreshCut :)

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I don't understand why you wouldn't use PHP in a case like this... I really don't think JS is necessary.
    Jeremy | jfein.net

  3. #3
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Well this is for something that is AJAX driven. I'm dealing with strings that come back as part of a JSON object from a web service. This in particular is for the heading of a Javascript pop-up window, so I don't think I would be able to use PHP here.
    My site: FreshCut :)

  4. #4
    Join Date
    Jul 2008
    Posts
    128
    Thanks
    0
    Thanked 17 Times in 16 Posts

    Default

    Quote Originally Posted by jlizarraga View Post
    Well this is for something that is AJAX driven. I'm dealing with strings that come back as part of a JSON object from a web service. This in particular is for the heading of a Javascript pop-up window, so I don't think I would be able to use PHP here.
    Code:
    str = str.replace(/([a-z])([A-Z])/g, "$1 $2");

Bookmarks

Posting Permissions

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