Skip to content

Tag: regex

Regex lookaround start of line

I have this regex https://regex101.com/r/wRBBAz/1 Testing with input I specified start of line (^) in lookaround so I don’t understand why it selects instead of only Answer The problem is that [^ .] matches any char but a space and a dot, that is, it matches line break chars. You can use See the regex d…

Matching paragraph with line breaks Regex

What regex can I use to match a paragraph (including line breaks) so when I use split(), I get an array with each sentence as one element? Something like this: I have that regex that returns [“one potatoe↵two apples↵”, “three onions”, “”] but what I’m looking for is […

Prevent regex from becoming greedy when using optional tokens?

I’m trying to use regex to extract information from different strings. For example, I have the following JSON: and want to write a regex that extracts into capture groups (1) the text up to the colon, (2) the text up to the comma, (3) the comma if exists, and (4) the text after the comma. Starting with …

Regex Extraction – Mixed Decimal seperator

I am currently trying to write a regex in js that would extract the decimal numbers from a mixed string. Example strings are following My desired output is following If I run the following regex it doesnot return any match when the decimal point is followed by a single digit.Eg. following cases I am not sure …

REGEX – Match a pattern in a lengthy string

I am trying to match a particular pattern in a lengthy string: NEW ZEALAND AND (data.operator1:”SHELL AND AMP” AND data.field:”NEW ZEALAND”) OR (data.operator:purpose AND data.field:crank) OR (data.operator:REGULATOR AND data.field:HELICOPTOR) I want to select all the below values foll…

Regex for Phone Number validation in JavaScript [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 1 y…