Example 4: 4-3/3-1

Here is an example of regex linking in a real-world scenario. Imagine you are trying to link to a specific part of a text, but the text is a mess of regular expressions.

Let's say you want to link to the 4th occurrence of the letter "a" in the string "Hello world, hello world, hello world, hello world".

Using regex, you can do this with the following link: regexlink

This will take you to the 4th occurrence of the letter "a" in the string, which is in the word "world".

But what if you want to link to the 4th occurrence of the letter "a" in the word "world"?

Well, you could use the following regex: worla

This will take you to the 4th occurrence of the letter "a" in the word "world", which is in the middle of the word.

And finally, what if you want to link to the 4th occurrence of the letter "a" in the string "a", but only if it's in the middle of the word "a", but only if the word "a" is surrounded by exactly 2 other words?

Well, you could use the following regex: aworlda

This will take you to the 4th occurrence of the letter "a" in the word "a", but only if it's in the middle of the word "a", and only if the word "a" is surrounded by exactly 2 other words.