Solved

Need a regular expression to parse between / forward slashes

Posted on 2013-05-28
14
464 Views
Last Modified: 2013-05-29
http://sccps-acorn/ddi/web/DLFT/TEST/one/21stwfd.jpg

1) url above
2) want to be able to identify the word "one". Everything before will be the same.
3) it is going to be the 6th word between the / forward slashes
4) would like to be able to configure which word between slashes ( ie 4th, 3rd etc)
5) i have a workflow that the 6th word will be the deciding factor when to run
6) want to ignore the file name

thank you
0
Comment
Question by:metatonka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 3
  • 2
  • +1
14 Comments
 
LVL 4

Expert Comment

by:Ahmed Hussein
ID: 39202574
I can't open the image, i'm getting a network error, but if you want to parse between 2 forward slashes you can use this regular expression.

\/([a-zA-Z0-9]{0,})

Open in new window


or try to upload the image on different site, so i can see what you really mean.
0
 

Author Comment

by:metatonka
ID: 39202694
1) sorry for the confusion, that url is not available to the web. It is the example of url that i need the regular express to run on.
2) your suggestion provided the following result  

/;/sccps;/ddi;/web;/DLFT;  

3) what i am looking for is a regular express that gives me the word between two forward slashes in the sixth place after the http:// which in this example would be the word "one".

please let me know if you have any questions.
Thank you for helping.
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 39202722
Try this pattern:
http://(?:[^/]*/){5}([^/]*)

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:metatonka
ID: 39202776
i tried extract with your suggestion, it came out blank
0
 

Author Comment

by:metatonka
ID: 39202781
my workflow regular expression has 4 options

replace text
check match
split
extract
0
 
LVL 4

Expert Comment

by:Ahmed Hussein
ID: 39202814
the solution TerryAtOpus posted, returns to results, the one you need is the second one, so if your RegEX workflow return an array, get the second element of that array.
0
 

Author Comment

by:metatonka
ID: 39202881
AhmedGeek i assume you are saying to use http://(?:[^/]*/){5}([^/]*)

this is what happens

use this  (?:[^/]*/){3}([^/]*)  results are http://sccps-acorn/ddi/web/DLFT;
use this  (?:[^/]*/){2}([^/]*)  results are http://sccps-acorn/ddi/web;
use this  (?:[^/]*/){4}([^/]*)  results .....nothing
use this  (?:[^/]*/){5}([^/]*)  results .....nothing

not sure where to proceed.
thanks
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39202920
What language or editor are you using?
0
 

Author Comment

by:metatonka
ID: 39203117
nintex workflow 2007 software on sharepoint 2007
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39203242
It appears that Nintex has .NET's regex library available. Modifying Terry's previous suggestion, try:

(?<=http://(?:[^/]*/){5})[^/]*

Open in new window

0
 

Author Comment

by:metatonka
ID: 39203377
getting closer

using extract

(?<=http://(?:[^/]*/){2})[^/]*   web;
(?<=http://(?:[^/]*/){3})[^/]*   DLFT;
(?<=http://(?:[^/]*/){4})[^/]*   -----nothing-----
(?<=http://(?:[^/]*/){5})[^/]*   -----nothing-----

almost there!!!!!!!!!!!!!!!!!
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39204231
That I'm not sure about. 4 and 5 work fine for me, and I don't have Nintex available to me for testing.

Screenshot
0
 

Author Comment

by:metatonka
ID: 39204278
will ask nintex about their regular expression interpreter...will tell you the results.
0
 

Author Comment

by:metatonka
ID: 39205451
response from nintex

This regular expression would work : \w+(?=/[\w\d]+\.[\w\d]+)

We use the .Net Regular Expression engine. The following site is generally what my colleagues and I use when it comes to help build expressions: http://gskinner.com/RegExr/ 

and it does work.

will give you the credit.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
As most anyone who uses or has come across them can attest to, regular expressions (regex) are a complicated bit of magic. Packed so succinctly within their cryptic syntax lies a great deal of power. It's not the "take over the world" kind of power,…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question