Why does regex not work for searching json? [closed] - regex

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a lot of different documents in which I want to find certain JSON, here is an example (regex101).
regex: {\"columns.*]}
I expect to get json like this:
{"columns":["1",{"title":"Bad Boys For Life","value":"Bad Boys For Life"},"2","686.5","764.5","874","877","897","937",{"value":"686.5","isMeta":true},{"isMeta":true,"value":"764.5"},{"isMeta":true,"value":"874"},{"isMeta":true,"value":"877"},{"value":"897","isMeta":true},{"isMeta":true,"value":"937"},"850398",{"value":"937","isMeta":true}]}
But that doesn't work, why?

Your regex misses a global flag so it only produces one match.
Here's the fixed version: https://regex101.com/r/o0j2Sk/2/
The reason you're getting downvoted though is that you should not use regex to parse JSON. It is extremely easy to parse JSON properly with any language, so that's strongly recommended to everybody.

Related

From String to Function [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'd like to know if there is a way to transform a string into a function em c++. For example if I have the string: "x+y" it'd create the function and by replacing x and y, get the value of it.
In Java there is this API https://www.objecthunter.net/exp4j/index.html, so I was wondering if there is something similar.
There are many possible methods one could use to transform a string into a "function". Many of those involve parsing the string and building a function-like object out of it.
A lightweight and portable solution would be to use ExprTk, a mathematical expression library developed by Arash Partow.
The main page contains various usage examples.

I need a regex for the following combination [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
mission_id: a498094578a
mission_id: a493453456
mission_id: 498343454a
mission_id: 34534535345
From the above 4 mission_id's I need your help in writing a regex pattern which covers all the four mission_id but need to select only the numbers.
So one the first one - need to exempt 'a' and only the numbers.
mission_id:\s*\w?(\d*)\w?
That should work; maybe add any flags you need for parsing multiline text or whatever.
www.regexr.com is a great resource for trying out RegExps

Regex use in Notepad++, searching [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a bunch of JSON key-value pairs. Most of them are empty, like this
"object": []
However, some of them aren't. I want to use Notepad++'s regex search to find every "object" that has something between the []. I know this is a very basic question, but I don't know anything about regexes except that they could probably be used to solve this problem. If someone can take a few seconds to answer my question it'd save me a lot of searching. Thanks!
You can just search for
\[.+\]

Regexp for firstname and lastname [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I would like to find a regular expresson for validating user input for FirstName and LastName. Is there som kind of standard for this? I would like to avoid strange signs, yet allow international signs like åäö, etc.
I am using .NET
Any recommendations?
It seems that there is no single simple aswers. Closing this topic.
This is not so easy to do.
One way to do it is like this:
[a-zA-Zåäö] etc.
Just add all the special characters needed to the list of allowed characters, but it's not how you should do it.
Instead, check this question on why this is a really difficult problem to solve:
What are all of the allowable characters for people's names?

What are the algorithms that can be use as a spell checker for Indic scripts [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've built Optical character recognition for Sinhala (Language in sri lanka). I've had success to some extent. Now What I need to do is post processing using dictionary data.
What would be the best approach for changing misspelled words into correct words? Can any one give suggestions?
I have the dictionary data files in unicode and also my OCR output also a unicode file. I am doing this using C++. I have tried out string matching algorithms with no success so far. I want to start the most relevant approach to this problem. Can anyone help me please?
Thanks in advance.