For a regular expression matching, even double quotation marks, the

If a string starts with #, ending with # No.
#str = str1 + "test";# //To match the success of
#str = "test" + str1 + "test";# //This can be matched successfully
#str = "test + str1";# //To match the success of
#str = "te"st" + str1;# //Can't match the success

As in the example above, there are no heroes to help write a regular expression, that is to match a string, which contain only even quotes. Quotation of the position is uncertain, as long as the number inside quotation marks is even on the line

Seeking advice, for discussion.

Started by Kenneth at February 05, 2016 - 12:16 AM


Come ah, I also give points~

Posted by Kenneth at February 15, 2016 - 12:42 AM

The 1 end is # No.,
2 even Quotes

var str = '#str = "test" + str1 + "test";#';
if(str.match(/^#.+#$/) && str.match(/\"/g).length%2 === 0) {

}

Posted by Lou at February 17, 2016 - 1:42 AM

Dear, oh oh... All I want is a regular expression, used for string matching, I was not know the contents of the string.

Posted by Kenneth at February 22, 2016 - 1:59 AM

IndexOf and lastIndexOf detection'#'Is it right? In 0 position and the str.length-1 position
match(/\"/g)Array elements are measured Is it right? Even
Try it
Do not know the contents of a string like ah

Posted by Lisa at March 08, 2016 - 2:09 AM

LZ, what the hell are you talking about? I don't know where STR is the content of the ah, don't I know? What?? The first line of the VaR STR? Tears ran ah ~ ~ ~ to me what to say?

Posted by Lou at March 21, 2016 - 2:28 AM

Like the following dialogue:

A: How to calculate the obesity index ah, I want a formula.
B: Set the height h, weight W (m) (kg) for example, h=1.8, w=90, =w index/(h*h)=90/(1.8*1.8)=27.78
A: Oh dear, no, I do not know in advance of height and weight, all I want is a formula, then calculate
B: Speechless + tears

Posted by Lou at April 03, 2016 - 2:32 AM

May be I did not say clearly, I is a short string above conditions from a string to find the fit, I want to find its location, and then to replace it. Say from A to Z traversal, I don't know this string in which position, do not know how long. All I need is a regular expression to match search, using regular expressions.
For example: matching Tencent QQ number: [1-9][0-9]{4,} like this.
Dear, you this is whether a string meets 1 end is #, containing 2 even conditions of the two quotation marks, and not find

Posted by Kenneth at December 20, 2016 - 9:40 PM

With the upstairs, thank you~

Posted by Kenneth at December 23, 2016 - 10:04 PM

Dear, you are a building problem really misleading.

/#([^"]*"[^"]*"[^"]*)+#/
A bit long winded, (some non quotes + quotes several non quotes quotes + + + some non quotes) repeat
Or: /#(([^"]*"[^"]*){2})+#/
Here are some details, such as # "" "" "" #, # #, ##, these extreme want, you see, the difference is * and +.

Posted by Lou at December 28, 2016 - 10:39 PM

I am a man, don't dear to me.
This problem, by regular failed.
To write a function.

Posted by Kristine at January 06, 2017 - 10:40 PM

If you are female.

Posted by Lisa at January 12, 2017 - 11:14 PM

Thank you ~ problem has been solved, according to what you said, actually very simple also, I think the question is not so thorough ~ learning.

Posted by Kenneth at January 12, 2017 - 11:50 PM

function check(str){
alert(/#.+=("[^"]+"|[^"+]+)((\+{1}"[^"]+")|(\+{1}[^"+]+))*;#/g.test(str.replace(" ","")));
}

Posted by Dave at January 13, 2017 - 12:04 AM