i 熟悉javascript permanent expression to notcompa. 在给予体力时(具有任何种类的特性),我想将其分为两条标语:“/”和“/”。 i 做了以下工作:
var patt = /.*[^"//"]/gm;
patt.exec(str);
但是,这似乎与引语之间特性的任何发生相吻合,即“/”和“/”。 如何做到这一点?
i 熟悉javascript permanent expression to notcompa. 在给予体力时(具有任何种类的特性),我想将其分为两条标语:“/”和“/”。 i 做了以下工作:
var patt = /.*[^"//"]/gm;
patt.exec(str);
但是,这似乎与引语之间特性的任何发生相吻合,即“/”和“/”。 如何做到这一点?
当你开始使用<代码>^的特性类别时(如您在<代码>[^”/>>中已有的),是指“除所列特性外的任何特性”。 http://www.un.org/Depts/DGACM/index_chinese.htm
If you re trying to match the text between two slashes (//
) and one backslash () (as per your question; you later made a comment suggesting it s two backslashes, I address that later), then:
var match = str.match(///(.*?)\/); // Match between // and
请注意,由于冲突是经常表达的限定词,我们必须避免冲突,因为反弹是越狱。
以上指“两lash,后一lash为零或以上,之后为后lash”。 www.un.org/Depts/DGACM/index_french.htm 非消费性(因此,其消费的特性可能满足这一表述)。 <>代码>( 创建capture group<>em>,在对应标的中,该组将获得与该职位相应的特性。
例:
test("foo");
test("foo //bar");
test("foo //bar\");
test("foo //bar\ baz");
test("bar\ baz");
test("//bar\ baz");
test("foo //bar\ baz \ more \ more");
function test(str) {
var m = str.match(///(.*?)\/),
cap = (m && m[1]) || "<em>nothing</em>";
display("Str: <code>" + str + "</code>: Captured <code>" + cap + "</code>");
}
产出:
范围:<0>
Str:
foo /bar
: Capturednothing
Str:
foo /bar
: 页: 1范围: 页: 1
Str:
bar baz
: Capturednothing
<>>>。Str:
/bar baz
: 页: 1Str:
foo /bar baz more
: 页: 1
Or for two backslashes:
var match = str.match(///(.*?)\\/); // Match between // and \
Live copy (the output is the same, just with two backslashes)
Some reading on JavaScript regular expressions:
RegExp
page怎么说
var tokens = str.split(///|\\/);
How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.
I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...
I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...
Is it possible for someone to give me a few pointers on how to display a multidimensional array in the form of a bar graph? The array is multidimensional, with three elements in each part - and the ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.