Using RegEx to match at least two words - regex

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 hours ago.
Improve this question
I have an app that lets me search files thousands of folders on my pc to identify any number of criteria. I need a RegEx to search for folders that have files named both poster.jpg AND poster.png only. There could be other similarly named files that I don’t care about. I only want to match poster.jpg and poster.png. Nothing I have tried thus far has worked.
According to the application help it uses ECMA-262 grammar but I looked at the documentation and I’m more confused than when I started. Help please.

Related

Why does regex not work for searching json? [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 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.

Match string inside 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 want to search for imports in my node modules from visual studio codes regex search, the problem is that i only want to search for imports that are inside functions and not in the whole file. How would i go about doing this?
const a = require('a'); // shouldn't match
function func() {
const b = require('b'); // should match
}
Despite the growing popularity of such features (search in functions, search outside of comments, search in strings, etc), VSCode still doesn't have built-in support for such these.
You'll have to use find with regular expressions for this one, but good luck on building the regex for "a particular pattern inside a function". A good hack that doesn't work all of the time is to detect indentation before your pattern: ^\s+.*YOURPATTERN

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
\[.+\]

Find pattern in Notepad++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm using Notepad++ to look at a broken CSV that won't import.
The pattern should be:
"text","text","text","text","text","text","text","text",date
Is there a way in Notepad++ to find lines that do not match this?
^(?!"[^"]*"(?:,"[^"]*")*,[\d\/]*$).+$
Use a negative lookahead. See this regex101 demo.
One thing that might work, depending on what you want to do with the result, is to simply find and remove all the correct instances. This leaves you with the broken lines. If you do this in a copy, you can then use the result to search for exact matches and find the locations in the original file.

Find .Include() chains using Visual Studio Regex Search [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have recently been asked to take over a large LOB application that uses Entity Framework. Many of the db calls being made use several (>5) Includes, which causes some very heavy query inefficiency. I want to use Visual Studio's search functionality to find some of these include chains. As a quick example, one might look like:
var res = ObjectContext.Items.Include("Details")
.Include("Users").Include("Users.Info");
I'd like to find any instance of more than 1 include, and match regardless of what the include path is.
How can I structure a search to identify these chains? Any help is most appreciated!
VS2012 uses .NET's regex flavor so you could do something like
(?:[.]Include[(]\s*"[^"]*"\s*[)]\s*){2,}
This matches one .Include("something") plus any white space after it and then requires at least two repetitions of this pattern. Note that you'll get problems if your strings contain quotes or you have verbatim strings in there. In that case the "[^"]*" would have to be a bit more elaborate.