w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Python regex to match 2 distinct delimiters

If I understand your needs correctly, you could use this:

[[(?:(?<uid>w+)::)?(?!.*::)(?<page>[^|	

fv]+)(?:|(?<alias>[^|	

fv]+))?]]
                      ^^^^^^^^

See here for a demo. I added a negative lookahead after the uid capture.

I have given names to the captured groups but if you don't want them, that's the one without named captured groups:

[[(?:(w+)::)?(?!.*::)([^|	

fv]+)(?:|([^|	

fv]+))?]]




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.