w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Spring configuration for writing a regex that can match a list of strings ?

You can use the comment modifier x:


<constructor-arg value="(ST RCP|ST CT J DISC P|ST JUV CT|ST J
                    (?-x)R BERKS CTY J ADMIN|R BERKS CTY RCP|(?x)
                    (?-x)R BERKS CTY RCRP|R CHESTER CTY RCP)">


<constructor-arg value="(?x)(STsRCP|STsCTsJsDISCsP|STsJUV
sCT| #you can
                             STsJsADMIN|RsBERKSsCTYsJsADMIN|Rs #put 
                             BERKSsCTYsRCP|RsBERKSsCTYsRCRP|RsC #comments

With the comment mode, the regex engine don't care about spaces, thus you must explicitly write all of them.

(?x) to activate the comment mode

(?-x) to desactivate

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