How to find a comma that is embedded in a string?
-
I have a Json data file like below:
{ "customers": { [ { "cus_id": "1234", "first_name": "John", "last_name": "Smith", "add_1": "2369 Lake St", "add_2": "", "city": "New York", "state": "NY", "zip": "10003", "company": "Joe Supplier, Inc." }, { "cus_id": "3456", "first_name": "Mary", "last_name": "Hope", "add_1": "208 Mountain View Way", "add_2": "APT-2", "city": "San Francisco", "state": "CA", "zip": "93102", "company": "Sunnywood Logistics, LLC." } ] } }
I just want to find the embedded (,) in the company value. How can I do that in Notepad++?
Thank you!
-
Using Notepad++'s “regular expression” mode in your search, you can search for
"company": "[^"]*\K,
– which will search for the key’s name, and the opening quote mark, then search for any non-quotemark until it finds the comma. The\K
just before the,
means it will only select what’s after the\K
when you click find, rather than selecting everything from the start of"company"
.However, you should probably read our FAQ: Parsing and Editing JSON with regex is a bad idea
----
Useful References
-
@PeterJones, thank you so much!