Is posible to set a text as optional in RegularExpresions?

Hola!

Se puede poner textos como opcionales en regex?

these days im reciving some logs with this format:

[07/12/2021 09:59:33 [Id XXXXXXXXXXXXXXXX] Parameters send to YYYYYY:
	action1: AAAAAAAAAAAA
	action2: BBBBBBBBBBBBBBBB
	action3: DDDDDDDDDDDDDDDDD
	log : file.log

these fields ( action 1, action 2 and action 3 ) are optional, therefore they may or may not come and I would like to parse them with a single Regex.

i tried something like
.....(action1: %{WORD:Action1} )? (action2: %{WORD:Action2} )? (action3: %{WORD:Action3} )?......

but it doesn´t appear to work.

is posible to set this text + fields as optional ?

thanks in advanced!

Did you not just ask this question in this post?

1 Like

Oh yes, i didn't find the other post, thank you!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.