Relative Content

Tag Archive for regex

Regex to match lines followed by another Line

I’m working with a text input and i need a regex pattern to capture lines that are followed by another line. Specifically i want to match lines that end with exactly one newline character and are immediately followed by another line (Except Last Line)

matching nested two-part patterns

I am processing various text strings to extract parameters and values for use in a ‘parameters’ table. These strings vary in size and complexity, so it’s not like I can expect a consistent syntax. One rule might say “the minimum distance to the next city is > 25.0 miles”. A different rule, however, might say “the minimum distance to (a city with a population >= 25000) is 70.0 miles”. The first rule only has one parameter ‘key’ (minimum distance), while the second also has a secondary key (population).

Reference – What does this regex mean?

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. What is this? This is a collection of common Q&A. This is also a Community Wiki, so everyone is invited to participate in maintaining it. Why is this? regex is suffering from […]