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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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