last day (15 days later) » 

11:31 AM
Ok, first you need to define the search for an anchor href tag:

> href='https://website.com/wiki/Some_Page'

But you may have different types of quotes; `"` or `'` wrapping the URL, so an OR choice needs to be set for these, giving a Full Regex (PCRE):

> @\s+href=('|")https://website\.com/wiki/([^'".]+)('|")@

- @ is the delimiter.
- `\s+` is a whitespace checker, because anchor links should be something like `<a href=...>`
- `href` is required to know it's a link (although you've not asked for this, so remove if you don't want it.
Of course if your quotes are all uniform then you can simplify that part and change the $2 to $1.
 
11:43 AM
Removed quote comparison

Find: "@\s+href="https://website\.com/wiki/([^".]+)"@"
Replace: " href='$1\.html' "
 
Hey @Martin
Thanks for answering!
Unfortunately this isn't working: pasteimg.com/image/afbeelding.c5pod
woops https changed to http, still not working though
 
there may be some tweaks specific to sublime regex, you will need to check the sublime documentation. ::

1) Check the delimiter (in my example it's a @ but could be something else in sublime, update accordingly.

2) check if you need to escape the . character, some editors do this automatically
It looks like you don't need the delimiters in Sublime editor
You should also read about the exact form of Regex that Sublime uses, in this case; boost: boost.org/doc/libs/1_75_0/libs/regex/doc/html/boost_regex/…
but it should work if you remove the @
 
Works now, big thanks to you @Martin !
"15148 matches across 2393 files"
 
awesome that's good :)
I would test the replacement works as expected on just one file first before triggering it across all of them ;-)
 
11:59 AM
smart suggestion indeed :)
You've already been a fantastic help but I've got one more Q:
Some links contain ":" these were converted to "%3A"
For example: "Help:Formatting" became "Help%3AFormatting"
Now when I open that page in Firefox, it becomes "Help%253AFormatting" (note the 25 before the 3)
How should I tackle this issue?
The most important issue is converting ":" to something else on the go.
The other issue of %3A becoming %253A is smaller because I can change the filenames to "-" for example. Still all ":" inside hrefs should somehow get converted to "-"
I have to go in a meeting but I'll be back in an hour (don't want to seem rude by not answering)
 
 
3 hours later…
2:42 PM
Use an edit to your regex to capture the : character as a group and then replace that group with a - character.
There are lots of SO questions on this exact issue. :-)
 

last day (15 days later) »