It is currently March 29th, 2024, 3:59 pm

Regex on Substitute not working

Get help with creating, editing & fixing problems with skins
User avatar
MetalTxus
Posts: 46
Joined: October 19th, 2016, 9:03 pm
Location: Spain

Regex on Substitute not working

Post by MetalTxus »

I'm trying to customize an existing steam skin and replace urls like this

Code: Select all

http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/apps/20920/f0274a91931ed39f7c69dca9f907ceae6450785c.jpg
...with the urls for the bigger images:

Code: Select all

http://cdn.edgecast.steamstatic.com/steam/apps/20920/header.jpg
The skin already used the following Substitute:

Code: Select all

Substitute="\/":"/"
...and I updated it to:

Code: Select all

Substitute="steamcommunity\/public\/images":"steam","\w*\.jpg":"header.jpg","\/":"/"
The first and third replacements work but the second one doesn't. Changing the replacement order does not change the output, so I suppose the issue is with the "\w*\.jpg" pattern itself. The issue is I don't see where or why.

Am I missing anything?
Last edited by MetalTxus on July 25th, 2017, 2:02 pm, edited 2 times in total.
Image
• GitHub | • DeviantArt
OS: W10 x64 / GPU: GTX 1050 Ti / CPU: i3-4160 / RAM: 8GB
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Regex on Substitute not working

Post by FreeRaider »

User avatar
MetalTxus
Posts: 46
Joined: October 19th, 2016, 9:03 pm
Location: Spain

Re: Regex on Substitute not working

Post by MetalTxus »

That's the second place I looked up and found nothing I deemed related. Could you please point me to what you suppose I must look at?
[hr][/hr]
EDIT: Solved.

It turns out the substitute wasn't actually using regex. The url value was returned, for any reason I ignore, as

Code: Select all

http:\/\/cdn.edgecast.steamstatic.com\/steamcommunity\/public\/images\/apps\/20920\/f0274a91931ed39f7c69dca9f907ceae6450785c.jpg
...instead of

Code: Select all

http://cdn.edgecast.steamstatic.com/steamcommunity/public/images/apps/20920/f0274a91931ed39f7c69dca9f907ceae6450785c.jpg
...hence my misunderstanding regex was being used for the replacement.

The following updated code worked:

Code: Select all

Substitute="\\\/":"/","steamcommunity\/public\/images":"steam","\w*\.jpg":"header.jpg"
RegExpSubstitute=1
Image
• GitHub | • DeviantArt
OS: W10 x64 / GPU: GTX 1050 Ti / CPU: i3-4160 / RAM: 8GB