English 中文(简体)
为什么我经常为空洞的工作表示?
原标题:Why doesn t my Regular Expression for an empty string work?

I ve tested this on Regexr and it w或ks, but it doesn t seem to w或k in AS3:

var emptyResult:* = new RegExp("^s*$", "gi").exec(myField.text);

var emptyResult:* = /^s*$/gi.exec(myField.text);

No matter whether I have text in the field 或 not, whitespace 或 non-whitespace, emptyResult is always null. I ve tried with and without the g and i tags, but nothing seems to w或k.

Anyone know why this might be?

最佳回答
  1. 你们不需要一只旗帜,而是无视案例,这只适用于拉丁字母字母,你使用这些旗帜。

  2. 举例来说,你需要躲避lash,否则就认为它是为了逃避以下信件。

  3. 你不需要国旗,因为你试图测试整个胎体(就你而言,条线和星号是同一件事,<条码>在<条码>之前将首先碰到底。

  4. 然而,在使用你的第二座舱位时,如果拆除了一只旗帜,那么我就会看到我所期望的结果,即,如果经过测试的舱体的整整整整条案文包括白色空间、制片、运输返回或线性饲料,那么整个舱位就会被退回。

例如:

trace(/^s*$/.exec(" 	
")[0].length); // 4
问题回答

暂无回答




相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...

热门标签