如何在其末尾用cross(x)按钮创建EditText?(How to create EditText with cross(x) button at end of it?)
有没有像
EditText
这样的小部件,其中包含一个十字按钮,还是有自动创建的EditText
的任何属性? 我想要十字交叉按钮删除在EditText
写的任何文本。Is there any widget like
EditText
which contains a cross button, or is there any property forEditText
by which it is created automatically? I want the cross button to delete whatever text written inEditText
.
原文:https://stackoverflow.com/questions/6355096
最满意答案
这些正则表达式是等效的(为了匹配目的):
/^(7|8|9)\d{9}$/
/^[789]\d{9}$/
/^[7-9]\d{9}$/
说明:
(a|b|c)
是正则表达式“OR”,意思是“a或b或c”,尽管OR所需的括号的存在也捕获数字。 要严格等效,您将编码(?:7|8|9)
使其成为非捕获组。
[abc]
是一个“字符类”,意思是“来自a,b或c的任何字符”(字符类可以使用范围,例如[ad]
=[abcd]
)这些正则表达式相似的原因是字符类是“或”(但仅适用于单个字符)的缩写。 在一个替代中,你也可以做一些像
(abc|def)
这样的东西,它不会转换成一个字符类。These regexes are equivalent (for matching purposes):
/^(7|8|9)\d{9}$/
/^[789]\d{9}$/
/^[7-9]\d{9}$/
The explanation:
(a|b|c)
is a regex "OR" and means "a or b or c", although the presence of brackets, necessary for the OR, also captures the digit. To be strictly equivalent, you would code(?:7|8|9)
to make it a non capturing group.
[abc]
is a "character class" that means "any character from a,b or c" (a character class may use ranges, e.g.[a-d]
=[abcd]
)The reason these regexes are similar is that a character class is a shorthand for an "or" (but only for single characters). In an alternation, you can also do something like
(abc|def)
which does not translate to a character class.
相关问答
更多-
您可以在全局使用以下正则表达式: \[(.*?)\] 说明: \[ : [是一个元字符,如果你想从字面上匹配,需要转义。 (.*?) :以一种非贪心的方式来匹配一切,并捕获它。 \] : ]是一个元字符,如果你想从字面上匹配,需要转义。 You can use the following regex globally: \[(.*?)\] Explanation: \[ : [ is a meta char and needs to be escaped if you want to match it ...
-
正则表达式中方括号和括号之间有什么区别?(What is the difference between square brackets and parentheses in a regex?)[2021-09-20]
这些正则表达式是等效的(为了匹配目的): /^(7|8|9)\d{9}$/ /^[789]\d{9}$/ /^[7-9]\d{9}$/ 说明: (a|b|c)是正则表达式“OR”,意思是“a或b或c”,尽管OR所需的括号的存在也捕获数字。 要严格等效,您将编码(?:7|8|9)使其成为非捕获组。 [abc]是一个“字符类”,意思是“来自a,b或c的任何字符”(字符类可以使用范围,例如[ad] = [abcd] ) 这些正则表达式相似的原因是字符类是“或”(但仅适用于单个字符)的缩写。 在一个替代中,你也可以 ... -
你需要使用lookarounds。 (?<=\(\[)(?:[0-9]{1,3}\.){3}[0-9]{1,3}(?=\]\)) DEMO 要么 由于javascript不支持look-behinds,我们唯一的选择是捕获组并打印索引1以获取ip-addresses。 \(\[((?:[0-9]{1,3}\.){3}[0-9]{1,3})\]\) DEMO 在javascript中,它会是这样的 > var str = "foo ([122.122.122.122]) bar" undefined > ...
-
state\s*\[([^]]+)\] 看看DEMO state\s*\[([^]]+)\] Have a look at the DEMO
-
此正则表达式将选择方括号,但通过使用组1,您将只能得到以下内容: "\\[\\[\\(.*\\)\\]\\]" This regexp will select the square brackets but by using group 1 you will be able to get only the content: "\\[\\[\\(.*\\)\\]\\]"
-
你有一个小写字母z ,它应该是upppercase。 更改: re.sub(r"[^a-zA-z0-9 ]+","",content) 至: re.sub(r"[^a-zA-Z0-9 ]+","",content) 对于记录,范围'A-z'扩展为字符A...Z , [ , \ , ] , ^ , _ , `` , a...z ; 这就是为什么你的正则表达式除去那些字符之外的所有东西。 ASCII表格: You have a lowercase z where it should be upppercas ...
-
根据OP的评论,没有不平衡的或逃避的报价。 牢记这一点是一个单一的replaceAll方法调用来实现这一点: String repl = input.replaceAll("(?:\\D(?=[^(]*\\))|\\)\\s*)", ""); //=> hello 123 使用积极的向前看,我们使用先行\\D(?=[^(]*\\))找到括号内的所有非数字,然后我们移除)然后在可选空格中交替。 RegEx演示 As per comment from OP there are no unbalanced o ...
-
(?:[^[]|^)\(([\w]*)\)(?!\]) 在Debuggex上实时编辑 不确定你在寻找什么,但这就是它的样子! 新编辑: (?:[^[]|^)?\((.*)\)(?!\]) 在Debuggex上实时编辑 编辑3: (?:[^[]|^)\((.*?)\)(?:(?!\])) 在Debuggex上实时编辑 (?:[^[]|^)\(([\w]*)\)(?!\]) Edit live on Debuggex Not really sure what you are looking for bu ...
-
干得好。 preg_match_all("~ \[( # open outer square brackets and capturing group (?: # open subpattern for optional inner square brackets [^[\]]* # non-square-bracket characters \[ # open inner sq ...
-
你可以使用下面的正则表达式, \[.*?\][^\]]*\] DEMO 你的代码是, //=> ...