Find and extract a substring from a string

Little_Ghost

New Member
Joined
Dec 13, 2010
Messages
48
I've been reading around and found all kinds of problems that where like the one I'm having, but none of the solutions worked for me.
I have a list with lines liek these:

****** name="email" content="dl-departmentmailbox">
<p><a href="mailto:dl-departmentmailbox">dl-departmentmailbox</a></p>
<li><a href="http://holidayplanner/cgi-bin/scheduele.pl?config=dl-all-deps">dl-all-deps</a></li>
<form name="PlanningRequest" method="post" enctype="text/plain" action="mailto:dl-planningrequest@mycompany.com?subject=Planning Request">

What I want/need to do is go through those strings and look for the part that starts with "dl-".
Then I need to copy/extract that + whatever is behind it.

I can't find a way to do it because the leading characters differ as do the ones at the back and the position and length of the string it need to find.

Is there an (easy) way to do this??

Kind regards
 
Read your post more carefully.
I think this will do it
=RIGHT(A1,LEN(A1)-FIND("dl-",A1)+1)
 
Upvote 0
I wanted to edit my previous post but couldn't so I'll post an answer instead:

I noticed the example data was not displayed correctly so i'll try again:
Code:
****** name="email" content="dl-department1"> 
[EMAIL="dl-department2"]dl-department2[/EMAIL]
 
[EMAIL="dl-all_departments@company.com"]dl-all_departments@company.com[/EMAIL]
 
<form name="Request" method="post" enctype="text/plain" action="mailto:dl-requests@company.com?subject=Request">
</form>
 
Upvote 0
I don't know what is going on. First post, almost all of the example data disappeared, now it does something weird again.. it looked fine in the preview.
 
Upvote 0
Read your post more carefully.
I think this will do it
=RIGHT(A1,LEN(A1)-FIND("dl-",A1)+1)

That does take care of the first part, but it also grabs whatever is behind the string.
I've tried editing my post but there's no edit option (anymore? for me?).
I tried posting the example data in 3 different ways but it always comes out wrong :(
 
Upvote 0
<form name="Request" method="post" enctype="text/plain" action="mailto:dl-requests@company.com?subject=Request">
HTML:
meta name="email" content="dl-department1"> 
<p><a href="mailto:dl-department2">dl-department2</a></p> 
<li><a href="mailto:dl-all_departments@company.com">dl-all_departments@company.com</a></li> 
form name="Request" method="post" enctype="text/plain" action="mailto:dl-requests@company.com?subject=Request">
</form>
 
Upvote 0
Check if this works out for you:

The starting point begins at dl- and the end point is ">

=MID(A1,SEARCH("dl-",A1,1),SEARCH(">",A1,1)-SEARCH("dl-",A1,1)-1)
 
Upvote 0
Check if this works out for you:

The starting point begins at dl- and the end point is ">

=MID(A1,SEARCH("dl-",A1,1),SEARCH(">",A1,1)-SEARCH("dl-",A1,1)-1)

it works as long as the dl- part is not mentioned twice, like:
Code:
<p><a href="mailto:dl-department2">dl-department2</a></p> 
<li><a href="mailto:dl-all_departments@company.com">dl-all_departments@company.com</a></li>
 
Upvote 0
may not be prettiest but if i understand correctly this might work

Code:
=("dl"&(TRIM(RIGHT(SUBSTITUTE(A1,"dl",REPT(" ",LEN(A1))),LEN(A1)))))
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top