Simple Regex Extraction [closed] - 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 9 years ago.
Improve this question
I'm assuming this is pretty simple but I'm going round in circles
<img src="\/\/i1.ytimg.com\/vi\/sY1S34973zA\/mqdefault.jpg"
I need to extract the sY1S34973zA portion.
I'm using PHP.
Any ideas?
Steve

This should do it:
<img src="[^"]+\/([^"\/]+)\/[^"]*"
The folder name is captured and can be replaced as $1.
I'm a little confused by the backslashes. Are you saying the backslashes are part of the string, or are they simply escaping the forward slashes in whatever language you're using?
If the latter, you'll need to make an adjustment or two above.

You can use this lookahead based regex:
[^/]+(?=\/[^\/]*$

Related

How to wrap all strings in a project with a macro / function? [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 5 years ago.
Improve this question
Ok so I have a string encryption thing that goesXorStr( "" ).
How can I put this on all strings without doing them one by one?
You can use the fact, that "Find and Replace" functionality also provides support for regular expressions. Thus, you may easily find all strings, capture them and wrap with XorStr().
In "Find" field, ((\".+?\")|('.+?')) will match all strings with double or single quotes. If you want only the double-quoted, reduce this to (\".+?\").
In "Replace with" field, use: XorStr($1).

Regex For Square Brackets with Quotes [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 6 years ago.
Improve this question
I am looking to extract all the entries from the following string:
[
"GUID_ID_ONE",
"2016-07-11T18:35:29Z",
"email#address.com",
"HASH_STRING",
"GUID_KEY_TWO",
"GUID_KEY_THREE"
]
I would like a RegEx to extract all the strings, quotes omitted. I have used
"(.*?)"
but this would appear to only find the first string.
Depending on the language you're using, the implementation can be different but you need to use the global modifier(g) to get all the matching strings, like this :
/"(.*?)"/g
Check here

Issue getting parsing this regex [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 6 years ago.
Improve this question
var regex = /^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð,.'-]+$/u;
Not sure how to include this as one string to run check on?
I think I have to escape the quote but I am not quite sure how to do it.
JavaScript regex engine does not support /u modifier.
Moreover, you do not have to escape any single or double quote inside a regex literal.
Thus, you can make this regex work bybjust removing the nonsupported modifier:
var regex = /^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð,.'-]+$/;

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.

Regex Find Anchor in String [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 9 years ago.
Improve this question
preg_match('.*<a\b(?=\s)(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\shref=['"]([^"]*)['"]?)(?:[^>=]|='[^']*'|="[^"]*"|=[^'"\s]*)*"\s?\/?>/m',$data,result);
how can i work with
php regex
find anchor link here.
This giving syntax error. how can we fix that.
you can see here working status.
http://www.rubular.com/r/G5F6AD5UyL
You need to escape the quotes in your regex - in Ruby that's not necessary because regexes are first-class objects with their own literal syntax, but not in PHP. Also, you need to add delimiters:
preg_match('~.*<a\b(?=\s)(?=(?:[^>=]|=\'[^\']*\'|="[^"]*"|=[^\'"][^\s>]*)*?\shref=[\'"]([^"]*)[\'"]?)(?:[^>=]|=\'[^\']*\'|="[^"]*"|=[^\'"\s]*)*"\s?/?>~m',$data,result);