I would like to create a pattern using regex. here is an example : dark blue red colored.
basically I wanna use regex to create a pattern that would select the expression whatever the color is. something like dark (word) colored
Can anyone help me please.
The following REGEX allows you to extract the color assuming dark
and colored
are static.
Matches in this example:
dark red colored - group(3) = red
dark red blue colored - group(6) and group(7) = red blue
^((dark)\s([a-z]*)\s(colored)|(dark)\s([a-z]*)\s([a-z]*)\s(colored))$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.