DESCRIPTION:
I have a string with a word, a number, bracket, and a letter inside the bracket.
QUESTION:
I want to extract only the numbers with decimal and the bracket with a letter in it.
EXAMPLE:
, INC., 5.5(b) -------> 5.5(b)
Section 13.2(k)(ii) ---------> 13.2(k)(ii)
WBNEOGNOFD.)! 82.3(b)(k)(ix) -----------> 82.3(b)(k)(ix)
ATTEMPT I MADE:
Find the first number then the decimal, followed by '('. But, sometimes, its only 1 number and no brackets after the decimal.
SOLUTION I THINK WOULD SOLVE BUT I COULD NOT SOLVE IT:
curly brace repetition qualifiers {} to match exactly three alphabetic characters and exactly four numeric characters. I tried the answer given by Christian Dean to solve for my regex, but it did not give an accurate result. ( Extract string with specific format )
To match digits with decimals followed by groups of ()
s, you can use
\d+\.\d+(?:\(\w+\))+
https://regex101.com/r/wqYZr9/1
\\d+\\.\\d+
- Match a decimal number (?:\\(\\w+\\))+
- Repeat a group of word characters in parentheses
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.