Java Regular expression for 1=1

erdarun

I need to look for java regex pattern that finds input string in the format of 1=1 where prefix of "=" should have same count of digits with the suffix. Also here both prefix & suffix values should be the same like 1=1, 11=11, 223=223. Values like 1=2, 3=22, 33=22 should not match the pattern

Can we have a general pattern to satisfy above rules.

Bohemian

Use a back reference:

(\d+)=\1\b

of course, in java you need to escape the back slashes:

"(\\d+)=\\1\\b"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Java - explain this regular expression (",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1)

From Dev

Java - explain this regular expression (",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1)

From Dev

$1 in Regular Expression is returning empty in Java

From Dev

$1 in regular expression javascript

From Dev

python regular expression "\1"

From Dev

Java Regular Expression to match 1 to 5 asterisks only

From Dev

Regular Expression to parse 112^3^1^1^

From Dev

Regular expression 0*1*1+11*0*1 DFA

From Dev

Regular expression for 7 digits not starting with 0 or 1

From Dev

PHP Regular Expression - {0,1}, ?, etc

From Dev

Meaning of \d{1-3 }in regular expression

From Dev

Regular Expression for a character attached to a number as "1a"

From Dev

Regular expression to change Ingredient 1 TO "Ingredient" + counter

From Dev

Regular expression to match 1 through 12 with padding?

From Dev

What is the meaning of the Regular Expression ^(.)\1+$

From Dev

regular expression with no more than 3 alphabets concurrently should not accept 1a1a1a1a1

From Dev

Regular Expression in Java for matching C 10 10 or L 1 2 6 2 or R 14 1 8 3

From Dev

Is `1/0` a constant expression in Java?

From Dev

Why is `+ 1` a valid expression in Java?

From Dev

Regular Expression with odd number of 1's and at least one 0

From Dev

Regular expression validation for string [01:3:14/ 1:8:20]

From Java

I have a certain regular expression to make but there is this 1 test that goes wrong

From Dev

Regular Expression to Match 1 Character and Single or Double Digit in Any Order

From Dev

Regular expression that checks for 1-10 in increments of .5?

From Dev

IsBasicLatin and IsLatin-1Supplement as JavaScript regular expression

From Dev

Regular Expression Find & Replace inserting \1 instead of string

From Dev

Regular Expression for (1ab09cs001)

From Dev

Regular expression for positive decimal value and -1 value in jquery

From Dev

Regular expression validation for string [01:3:14/ 1:8:20]

Related Related

  1. 1

    Java - explain this regular expression (",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1)

  2. 2

    Java - explain this regular expression (",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1)

  3. 3

    $1 in Regular Expression is returning empty in Java

  4. 4

    $1 in regular expression javascript

  5. 5

    python regular expression "\1"

  6. 6

    Java Regular Expression to match 1 to 5 asterisks only

  7. 7

    Regular Expression to parse 112^3^1^1^

  8. 8

    Regular expression 0*1*1+11*0*1 DFA

  9. 9

    Regular expression for 7 digits not starting with 0 or 1

  10. 10

    PHP Regular Expression - {0,1}, ?, etc

  11. 11

    Meaning of \d{1-3 }in regular expression

  12. 12

    Regular Expression for a character attached to a number as "1a"

  13. 13

    Regular expression to change Ingredient 1 TO "Ingredient" + counter

  14. 14

    Regular expression to match 1 through 12 with padding?

  15. 15

    What is the meaning of the Regular Expression ^(.)\1+$

  16. 16

    regular expression with no more than 3 alphabets concurrently should not accept 1a1a1a1a1

  17. 17

    Regular Expression in Java for matching C 10 10 or L 1 2 6 2 or R 14 1 8 3

  18. 18

    Is `1/0` a constant expression in Java?

  19. 19

    Why is `+ 1` a valid expression in Java?

  20. 20

    Regular Expression with odd number of 1's and at least one 0

  21. 21

    Regular expression validation for string [01:3:14/ 1:8:20]

  22. 22

    I have a certain regular expression to make but there is this 1 test that goes wrong

  23. 23

    Regular Expression to Match 1 Character and Single or Double Digit in Any Order

  24. 24

    Regular expression that checks for 1-10 in increments of .5?

  25. 25

    IsBasicLatin and IsLatin-1Supplement as JavaScript regular expression

  26. 26

    Regular Expression Find & Replace inserting \1 instead of string

  27. 27

    Regular Expression for (1ab09cs001)

  28. 28

    Regular expression for positive decimal value and -1 value in jquery

  29. 29

    Regular expression validation for string [01:3:14/ 1:8:20]

HotTag

Archive