regex « global « Javascript Data Type Q&A

Home
Javascript Data Type Q&A
1.Array
2.Clojure
3.date
4.decimal
5.function
6.global
7.loop
8.math
9.number
10.object
11.Regular Expression
12.scope
13.String
14.Var
15.variable
Javascript Data Type Q&A » global » regex 

1. Javascript Regexp not returning global results    stackoverflow.com

It's my understanding that all three of these lines below should return an ARRAY with 2 results in it. Yet RegExp will only return 1 result no matter how many times ...

2. js replace global doesn't like +?    stackoverflow.com

So I've been playing around with the replace function (method?) in js.

$get('msgBar').replace(/+/g,' ');
Let's say the content of $get('msgBar') is "Welcome+back+now". replace('+',' ') would only replace the first +, and not the second. replace(/+/g,' ...

3. Slow JavaScript Regex when using global attribute    stackoverflow.com

I am trying to replace strings in brackets in some html string. When I use a regular replace, its fast, when I try to create a pattern for global replace, it ...

4. RegExp.exec not returning global results    stackoverflow.com

According to MDC https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp/exec the following code should log each of the global matches for this regexp.

var str = "(^|\\+)(1\\+1)($|\\+)";
var regex = new RegExp(str, "g");
var result;
var testString = "1+1+1";
while ...

5. JS Regex: Cannot use captures when using global?    stackoverflow.com

It seems that I cannot use captures when using the global option?

var regex = /^\s*\[(.*)\]:\s+(\S+)(\s+"(.*)"\s*)?$/gm;
var matches = textareaText.match(regex);
for (var i in matches) {
  console.log(matches[i]);
}
I just get
match 0: [1]: ...

6. A (simple?) RegEx question for global non capturing groups    stackoverflow.com

Say I have the string Hello {{name}}, how are you doing today? I'm trying to grab name from that string. So far, I have /\{{2}[a-z0-9]*\}{2}/gi. The problem, is, it grabs {{name}} and ...

7. Consecutive calls to RegExp test fail for pattern with global option    stackoverflow.com

I've been wrestling with this all day, and I can't figure out if I'm doing something wrong or if I've found a bug in Chrome's JavaScript engine. It appears that consecutive ...

8. Javascript, simple: make global    stackoverflow.com

Here is a simple regex expression...

document.getElementById('testing').value=f2.innerHTML.replace(">",">\n");
The problem is it stops after the first linebreak, how can I make it do the whole table? Thanks!

9. How to search global variables in JavaScript    stackoverflow.com

Is there any tool or regexp that might help to get list of all global variables in JavaScript project?

10. Global regex matches    sitepoint.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.