Javascript regex special character not working

tamlevn

I have a string:

for (;;); {
  "__ar": 1,
  "payload": null,
  "jsmods": {
    "require": [
      ["ServerRedirect", "redirectPageTo", [],
        ["https:\/\/bigzipfiles.facebook.com\/p\/dl\/download\/file.php?r=100028316830939&t=100028316830939&j=11&i=5823694&ext=12121516&hash=AaBVNURld6wrKBcU", true, false]
      ]
    ],
    "define": [
        ["KSConfig", []
        }

I try to regex this to be: https://bigzipfiles.facebook.com/p/dl/download/file.php?r=100028316830939&t=100028316830939&j=11&i=5823694&ext=12121516&hash=AaBVNURld6wrKBcU

I've used

var results = $(document).find("pre").html();
var regex1 = new RegExp(/["\w\.\/\;\?\=\-\&\\\\"]/);
var resultsReplace = regex1.exec(results);
console.log(resultsReplace);

but it is not working.

Can anyone help me, please?

extempl

Assuming it is always URL and the delimiter is always " we can use a much simpler regex here, like:

str.match(/http[^"]+/)[0]

So we looking for a string starting with http with any following characters except " since the match string never can get one because this is a delimiter.

LMK if cases are wider (not an url, may not start with http, etc.) and I'll adjust regex.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Appending a special character with javascript not working

Dealing with special character in Nokogiri / Regex

Javascript regex match only words starting with a specific special character

Javascript REGEX not end with some special character but return true

Regex replace special character

Javascript param with special character

Why # character is special in javascript?

Regex not escaping a special character

Javascript typescript append special character to string is not working

strpos function not working with special character

Regex to fetch string until the occurrence of a special character in javascript

Regex for including a special character

RegEx match special character in Dialogflow

Javascript Regex Replace String with Special Character

how to regex match with the special character /?

XML special character escape not working

Appending a special character with jQuery not working

Regex dismatch repeat special character

Regex remove a special and duplicated character from the string in javascript?

Javascript regex in with special character in between

Regex for optional first special character

Javascript Regex for any one mandatory special character

php regex special character

Javascript regex test again a single string that has no special character or spaces

Initcap is not working with Special character

How to find a regex in JavaScript for special character "{" after certain special character "\""?

Regex: Character set with special characters

cfinvokeargument with special character not working in SELECT

Regex ignore special character with greedy

TOP Ranking

HotTag

Archive