Edit VBA Code

horrellbt01

Board Regular
Joined
Mar 15, 2010
Messages
68
I need to edit the following code that someone wrote years ago (no longer w/ the company) to work with a new source.
Set expr = New RegExp
'expr.Pattern = "src=""([^""]*ObjectiveImages[^""]*/([^""/]*\.jpg))"""
'ClientCommentImages
expr.Pattern = "src=""([^""]*Images[^""]*/([^""/]*\.jpg))"""
expr.Global = True
expr.IgnoreCase = True

The source format has changed to the following format: https://www.qtraxweb.com/p/90767-719431-us/TX/90458979_172130162.JPG
Everything after the /p/ would be a wildcard except the .JPG.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Would you mind confirming what you want as the end result of the RegEx? I think you want "90767-719431-us/TX/90458979_172130162.JPG", but I'm not completely certain. What happens with the RegEx in the code?

Do you have a few more examples of URLs for testing? Would all of the images start with the same domain? If so, can you just use the MID formula to extract the image name more easily? If not, are you able to use the new RegEx formula in the latest Excel365?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,563
Messages
6,160,506
Members
451,654
Latest member
DIIA

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