-1

I am trying to match ) if there is a ( and two numbers to the left of it.

Example "(55)" I want to match ) in "(55)"

I do not want to match "(hello world 55)"

I currently have the following as my regex:

     \(\d+\)

It matches "(55)" but I just want the ) in it. Is there a way to get a certain character by placement in a regex? Or do you have a better solution?

2 Answers2

0

There are multiple ways to match what you want.

For instance, you can use \K to rest the previous match:

\(\d+\K\)

Using positive lookbehind

(?<=\(\d+)\)

Also capturing the content for the match

\(\d+(\))
Federico Piazza
  • 30,085
  • 15
  • 87
  • 123
0

Flutter and all Languages supported

Insert all Special Character, Number, Lowercase & Uppercase

condition 1: Must Length of word 8 condition 2: Insert any of above given list (Not Must in all type)

r'^([a-zA-Z].)*.{8,}$' ,

Must Insert Atleast One in Above given list,

r'^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]+!@#\$&*~{8,}$',