0

I have a log message that i want to match only if two captured groups are the same! example

some date from source-ip=1.1.1.1 trying to send another data to the destination-ip=1.1.1.1 in addition to some date

So, i want to trigger if sip=dip it matches!? Would it be possible using a single regex?

1 Answer 1

1

Yes, this can be done via back-references. https://www.regular-expressions.info/backref.html

Using "some date from source-ip=1.1.1.1 trying to send another data to the destination-ip=1.1.1.1 in addition to some date" as input:

(\d+\.\d+\.\d+\.\d+).*(\1)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.