☰
d2jsp
Rules
Help
Forum Gold FAQ
Live Streams
Photo Gallery
Hourly Raffle
Ladder Slasher
Log In
Register
Log In
Register
Account Recovery
Resend Validation Email
d2jsp Forums
>
Off-Topic
>
Computers & IT
>
Programming & Development
> Need A Regex > Pls Halp!
Add Reply
New Topic
New Poll
Views: 342
Replies: 7
Track Topic
golddigga
Member
Posts: 6,864
Joined: Dec 5 2007
Gold
:
0.90
#1
Aug 12 2014 11:10am
url/foo/
this
:bar
i need to check if theres a word in the url. its allways the same pattern.
foo/
before
:
afterwards.
will /
regex
/.test(
myword
) work then?
thx guys!
AbDuCt
Member
Posts: 13,425
Joined: Sep 29 2007
Gold
:
0.00
Warn: 20%
#2
Aug 12 2014 01:47pm
What language?
You can just match against a list of words like so
Code
data =~ /this|bar|foo/
Of if you need to capture a specific word you can enclose the regex in brackets which will return the match.
Go to
http://rubular.com/
it's meant for ruby but regex is roughly the same for all languages.
m0hawk
Member
Posts: 1,241
Joined: Jun 25 2011
Gold
:
Locked
#3
Aug 12 2014 04:56pm
I suck at regexes but something like
Code
foo/[a-z]*:
maybe?
Qord
Member
Posts: 8,110
Joined: Sep 23 2006
Gold
:
3,558.23
#4
Aug 12 2014 08:17pm
Powershell can do this too.
What else are you trying to do? Do you have a text file that feeds all the url's to you?
j0ltk0la
Member
Posts: 62,204
Joined: Jun 3 2007
Gold
:
9,039.20
#5
Aug 13 2014 12:10am
Quick dirty and will probably break
Code
[http|https].*\/(.*):.*
It is sure to find whatever is before the colon, since it makes a nice delimiter.
If you post more information maybe I can make it more explicit.
Civill
Member
Posts: 859
Joined: Jul 2 2008
Gold
:
27.00
#6
Aug 13 2014 06:41am
http://regexr.com/
Meridius
Member
Posts: 23,728
Joined: Aug 21 2007
Gold
:
433.48
Trader:
Trusted
#7
Aug 20 2014 10:06am
Code
.*/foo/[^:]*:
should work
Kaylin
Member
Posts: 2,086
Joined: Oct 28 2013
Gold
:
3,961.00
#8
Aug 28 2014 01:34am
#px"[:alpha:]{\/{2}}[[[word]]+\/]+\/[[[word]]\:[[word]]"
Go Back To
Programming & Development
Topic List
Add Reply
New Topic
New Poll
© 2003-2024 d2jsp
Contact