this post was submitted on 10 Jun 2025
9 points (100.0% liked)

RegEx

410 readers
1 users here now

Welcome to the RegEx community! This is a place where you can learn about and get help with regular expressions

A regular expression is a sequence of characters that specifies a match pattern in text. Theyre usually used for find, or find and replace operations on strings, or for input validation.


founded 2 years ago
MODERATORS
 

(?<!\d)\d+\.\d+ should match the numbers at the end of the lines and yet it won't. What am I doing wrong?

you are viewing a single comment's thread
view the rest of the comments
[–] Diluvian 1 points 1 week ago

(?<!\d) -> Not sure why you're doing this.

\d+\. -> Look for at one or more digits followed by a period. None of the sentences have numbers before the period, and if the previous section didn't exclude them, this would.

\.\d+ -> look for a period followed immediately by one or more numbers. This should get most of the trailing 0's, but you'll miss the ones on their own newline and following a quotations mark.

\.0\ -> If you only have a single character you'd like to remove, there's no harm in enumerating it.