Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

RE treat whitespace as one word

New to regex (python). I have a data set that looks like this

{"Model": "NV3500 HD Cargo"},{"Model": "Armada"},{"Model": "Rogue"}, {"Model": "Frontier Crew Cab"},{"Model": "NV2500 HD Cargo"}, {"Model": "TITAN XD Single Cab"},{"Model": "Altima"},

I am attempting to only match what model value is IE NV3500 HD Cargo or Frontier Crew Cab

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I am using this expression to match \b(?!Model\b)\w+

it matches the correct terms however with models that have spaces it treats them as induvial matches

enter image description here

How can I treat it as one word

>Solution :

\b(?!Model\b)([\w\s]+)

Put also it in group.

if you want to capture symboles also, use

\b(?!Model\b)([^\"]+)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading