webdevRefinery Forum: Help with regex? - webdevRefinery Forum

Jump to content

Think a topic deserves its own subforum?

Any topic that gets popular here will have a subforum made for it, as long as there are folks around who can answer questions! So if you think wdR is missing something, just talk about it here :)
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rate Topic: -----

User is offline Fike 

  • Group: Members
  • Posts: 340
  • Joined: 26-October 10
  • LocationIreland
  • Expertise:PHP,Javascript,Python,SQL

Posted 25 June 2012 - 10:28 AM (#1)

Help with regex?


I'm making a regex to match and group different parts of an iTunes link (Quinn helped me with a lot of it). Here it is:

^((http|https)://(itunes\.apple\.com))(\S+)/id(\d+)/*


That groups the different parts fine, but it doesn't seem to actually match it. Try testing it with these URLs:
http://itunes.apple....d343200656?mt=8
,
http://itunes.apple....d343200656?mt=8
.

Could someone tell me why it doesn't match them?

Thanks!
web developer :: HTML, CSS, JavaScript (node), Python, PHP, MySQL, Mongo.
server admin :: experience with debian (and debian based distros), Gentoo, FreeBSD, OpenBSD.
social :: @nixhead (Twitter), Fudge (IRC), Github (FionnK), Personal Blog.
0


User is offline Koen 

  • Leroy Jenkins
  • Group: Members
  • Posts: 2503
  • Joined: 10-March 10
  • Locationthe Netherlands
  • Expertise:HTML,CSS,Javascript,Graphics

Posted 25 June 2012 - 10:34 AM (#2)

On http://regexpal.com/ it seems to match perfectly, so I guess it's the way you're using the regex that's causing the problem. What's the piece of code where you use it?
Please click the + if I helped you!
Twitter: @KoenKlaren

<callumacrae> YOU DID A ROMNEY
0


User is offline Fike 

  • Group: Members
  • Posts: 340
  • Joined: 26-October 10
  • LocationIreland
  • Expertise:PHP,Javascript,Python,SQL

Posted 25 June 2012 - 10:52 AM (#3)

View PostKoen, on 25 June 2012 - 10:34 AM, said:

On http://regexpal.com/ it seems to match perfectly, so I guess it's the way you're using the regex that's causing the problem. What's the piece of code where you use it?

I used a different regex testing site, hmm. I'm using it in JavaScript. I'll try it out now.

Yeah, works now.
web developer :: HTML, CSS, JavaScript (node), Python, PHP, MySQL, Mongo.
server admin :: experience with debian (and debian based distros), Gentoo, FreeBSD, OpenBSD.
social :: @nixhead (Twitter), Fudge (IRC), Github (FionnK), Personal Blog.
0


User is online TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 25 June 2012 - 12:21 PM (#4)

I use rubular.com even for non ruby regex
Reserved.
0


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users


Enter your sign in name and password


Sign in options
  Or sign in with these services