dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Regular Expression Solution

  1. #1
    Join Date
    Aug 2010
    Posts
    27

    resolved [RESOLVED] Regular Expression Solution

    I am pulling a URL from the address bar and parse it down until I get this
    (The 'sortby' changes so I have to detect it dynamically)

    sortby=industry&tuition=true

    OR

    sortby=industry

    I want this to return

    tuition=true

    OR

    Nothing

    This is the regex I am currently using. It works for one but not the other.
    /(^sortby=)[A-Za-z|\_|\+|\W]{1,}&/

    Thank you for you time!

    Michael

  2. #2
    Join Date
    Sep 2010
    Posts
    160
    The following regular expression should work:

    /sortby\=[^&]+&?/

    it looks for "sortyby=" followed by anything that is not a "&" character and in the end an optional "&" character.

    Archie

  3. #3
    Join Date
    Aug 2010
    Posts
    27
    Thanks Archie Worked Great!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles