You are here

regex Expressions in Rules?

4 posts / 0 new
Last post
bahala520
Offline
Joined: 7 years
Last seen: 5 years
regex Expressions in Rules?

regex Expressions in Rules

for example Aaacasfafa-ssafafafafafafafafasahfgf

What rules are used to delete - all the characters that follow

Index_title.modify {replace (type = regex) | - (?<=-) [a-zA-Z0-9] |} is ineffective

Blackbear199
Offline
Blackbear199's picture
WG++ Team memberDonator
Joined: 9 years
Last seen: 4 hours

why didnt u use separator when u scrubbed it?

index_title.scrub {single(separator="-" include=first)|[your title scrub]}

or with regex afterwards(like u asked)

index_title.modify {remove(type=regex)|"^[^-]*(-.*)$"}

^ - start form beginning
[^-]* - zero or more of any character thats not a -
(-.*)$ - whats to be removed,in this case...a real - and everything afterwards to the end of the element

the beginning and ending " are delimiters,all regex expression need to be enclosed in them(when using type=regex).

bahala520
Offline
Joined: 7 years
Last seen: 5 years

Examples of AAAA (dasadsa) gdggf (1) fafafaf

Need to delete and replace the last occurrence of () content should be written regex

Blackbear199
Offline
Blackbear199's picture
WG++ Team memberDonator
Joined: 9 years
Last seen: 4 hours

not sure what u mean?
u want to delete (1)?

its it always a number inside (x)?

element.modify {remove(type=regex)|"(\s\(\d+\))[^\(]*$"}

\s - a space
\(\d+\) - one or more numbers inside ()
[^\(]*$ - start from the end

Log in or register to post comments

Brought to you by Jan van Straaten

Program Development - Jan van Straaten ------- Web design - Francis De Paemeleere
Supported by: servercare.nl