Regex Find Anchor in String [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
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);

Related

How to “inverse match” with regex without content? [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 4 years ago.
Improve this question
I have read How to "inverse match" with regex? and i would like to know if i can apply it to a non-content regex. In particular i'm talking about: ^[A-z0-9+\/]{44}$
I tried https://regex101.com/r/NmOs7Z/1 but it does not work
I didn't get exactly what you really, but from my understanding you want to match the two lines in your demo
So what i did :
^(?![a-zA-Z0-9+\/]{44}).*$
Demo

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àáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð,.'-]+$/;

Regex Expression Required [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 am new to this regex thing, how can we build regex expression for following thig
input==>[User:1490474408:michaelayliffe]
output should be ==>1490474408
input will be anything like below:
1.[User:1490474408:michaelayliffe]
2.[User:12345:dfhdfhdf]
3.[User:56789:utyutyutyu]
Output should be middle value.
Please reply.
(?<=\[User:)[^:]+
Using lookbehind should work for you.
/\d+/g
It is find digits those are middle of your string

Simple Regex Extraction [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
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:
[^/]+(?=\/[^\/]*$