-3

This is the sample text I want to get the regex of the Match specified string that regex will qualify the Not match conditions

1abc.def.ghi (Match)

abc.111.ghi (Match)

123.123.123.132.123.123 (Match)

123.123.123.132.123.123.123.123.123.132.123.123.123.123.123.132.123.123(Match)

123.123.123.132.123.12335 (Not Match)

7645.123.111.887 (Not Match)

Ajil Raju
  • 27
  • 1
  • 6

1 Answers1

0

The task is defined by example.

Let's try to formalize it:

all valid matches contain only characters from the set [123abcdefghi.];

significance of 3 characters separated by dot is questionable because one valid example has 4 characters in a row. Let's assume we can have arbitrary number of characters separated by dots.

It is unclear if we can use any letter from the valid range in any group; let's assume that all groups are equivalent

then, repeated group will be [123abcdefghi\.]+

Add start and end anchors to match complete lines only:

r='^[123abcdefghi.]+$'

this is one of many possible understandings of this set of examples.