Link to home
Start Free TrialLog in
Avatar of Marc_Engrie
Marc_EngrieFlag for Belgium

asked on

Regex problem

Hello,

I have a string of multiple 'blocks' of colors in Hex notation. The number of blocks can vary from 1 to 9. each is separated with one or more spaces.

eg: string with 2 block  BLCK1:#222222 BLCK2:#333333
string with 4 blocks  BLCK1:#123456 TEXT:#654321 LINE:#334455 FONT:#214365

I want to validate such a string line against some basic rule:
.*?:#[0-9a-f]{6}.

but how can I do this for every block in the string within the regex?
Avatar of kaufmed
kaufmed
Flag of United States of America image

What do you mean by "validate"? Your pattern should match each occurrence.
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marc_Engrie

ASKER

working

Thx!
Additional about this:

what needs to change in the regex in order to detect/allow besides

BLCKX#123456   also   BLCKX#12345678

but not  BLCK1:#1234567

What is the difference  between   .*?  (lazy)   and  [^#]