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

Related

How can i replace the given indices of a string using regex [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 replace certain indices of a string such as:
"123456789" i want 2nd and 8th indices to replace each other.
So the result will be "129456783". How can i achieve that ?
EDIT :
Thanks to answer , i found my solution and i am writing it here just in case anyone needs it.
var str = "123456789";
var res = str.replace(/(\d{2})(\d{1})(\d{5})(\d{1})/g, "$1$4$3$2");
This should do the trick !
Using capturing groups and backreferences.
Regex:
(..)(.)(.....)(.)
Replacement pattern:
$1$4$3$2
Note that the exact syntax depends on regex flavor (i.e. the tool used).
Some tools define backreferences via backslash, i.e. \1\4\3\2, and some tools don't support backreferences.

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

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

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);