Results 1 to 6 of 6

Thread: [RESOLVED] spot the regex misstake

  1. #1

    Thread Starter
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Resolved [RESOLVED] spot the regex misstake

    Can any one spot the miss take

    Code:
    Private firstRegex As String = "http://www\.mixcloud\.com/api/1/cloudcast/[\w\d]+.json?embed_type=website_unknown"
    Two examples of the url for you

    Code:
    'http://www.mixcloud.com/api/1/cloudcast/lamixette/lamixette46-danny-drive-thru.json?embed_type=website_unknown';
    
    'http://www.mixcloud.com/api/1/cloudcast/LaidBackRadio/fatoosan-supafly-indian-summer.json?embed_type=website_unknown';

  2. #2
    Fanatic Member
    Join Date
    Aug 2010
    Posts
    624

    Re: spot the regex misstake

    Well for starters, before the ".json" you forgot to cancel the ".", same with the following "?" also, the URL contains "-" in the section where you only used \w and \d

    Try this (can't be bothered opening VB so hope it works)

    Code:
    Dim pattern as string = "http://www\.mixcloud\.com/api/1/cloudcast/[\w\d-]+\.json\?embed_type=website_unknown"
    If it doesn't work I'll open VB and see if I can get it

    EDIT, looking at it you forgot another section

    Dim pattern As String = "http://www\.mixcloud\.com/api/1/cloudcast/[\w\d-]+/[\w\d-]+\.json\?embed_type=website_unknown"

    that should work, i think
    Last edited by J-Deezy; Oct 17th, 2010 at 10:36 AM.
    If I helped you out, please take the time to rate me

  3. #3

    Thread Starter
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Re: spot the regex misstake

    Thanks once again J-Deezy. I thought i would start practicing Regex after your post yesterday.

    Feel a bit silly i missed canceling them bits now

  4. #4
    Fanatic Member
    Join Date
    Aug 2010
    Posts
    624

    Re: spot the regex misstake

    Hehe no problemo. I like spotting the Regex threads as it gives me a chance to practice it

    (I hope you also saw the missing part of the pattern I edited in as well)
    If I helped you out, please take the time to rate me

  5. #5

    Thread Starter
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Re: spot the regex misstake

    Yes i see that <--- wolly

    I'm sure i will have plenty more regex query for you. One question. You added - [\w\d-] for the part where it contained - between the / / But why did the first one. the one i had missed need a - [\w\d-]

    ??

  6. #6
    Fanatic Member
    Join Date
    Aug 2010
    Posts
    624

    Re: [RESOLVED] spot the regex misstake

    Oh I just used the same combination as I wasn't 100&#37; sure of the structure for the URL, who knows?

    Code:
    "http://www\.mixcloud\.com/api/1/cloudcast/[\w\d]+/[\w\d-]+\.json\?embed_type=website_unknown"
    Would probably still work, but if any URLs had /1/cloudcast/word-name/example-lol.......
    it wouldn't match them as there is a "-" in the 1st block.

    EDIT: Revised pattern (much simpler)

    Code:
    Dim mPattern As String = "http://www\.mixcloud\.com/api/1/cloudcast/.+/.+\.json\?embed_type=website_unknown"
    Last edited by J-Deezy; Oct 17th, 2010 at 11:18 AM.
    If I helped you out, please take the time to rate me

Posting Permissions

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



Click Here to Expand Forum to Full Width