如何在其末尾用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 for EditText by which it is created automatically? I want the cross button to delete whatever text written in EditText.


原文:https://stackoverflow.com/questions/6355096
2024-04-24 06:04

满意答案

这些正则表达式是等效的(为了匹配目的):

  • /^(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.

相关问答

更多

正则表达式提取方括号之间的文本(Regular expression to extract text between square brackets)

您可以在全局使用以下正则表达式: \[(.*?)\] 说明: \[ : [是一个元字符,如果你想从字面上匹配,需要转义。 (.*?) :以一种非贪心的方式来匹配一切,并捕获它。 \] : ]是一个元字符,如果你想从字面上匹配,需要转义。 You can use the following regex globally: \[(.*?)\] Explanation: \[ : [ is a meta char and needs to be escaped if you want to matc...

正则表达式中方括号和括号之间有什么区别?(What is the difference between square brackets and parentheses in a regex?)

这些正则表达式是等效的(为了匹配目的): /^(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] ) 这些正则表达式相似的原因是字符类是“或”(但仅适用于单个字符)的缩写。 在一个替代中...

正则表达式在括号和方括号之间获取ip(Regex get ip between bracket and square bracket)

你需要使用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" undefin...

正则表达式从正方括号中提取?(Regex to extract from square brackets?)

state\s*\[([^]]+)\] 看看DEMO state\s*\[([^]]+)\] Have a look at the DEMO

如何在Emacs中创建正则表达式来捕获双方括号之间的文本?(How do I create a regex in Emacs to capture text between double square brackets?)

此正则表达式将选择方括号,但通过使用组1,您将只能得到以下内容: "\\[\\[\\(.*\\)\\]\\]" This regexp will select the square brackets but by using group 1 you will be able to get only the content: "\\[\\[\\(.*\\)\\]\\]"

python正则表达式不检测方括号(python regex not detecting square brackets)

你有一个小写字母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 uppp...

如何使用正则表达式删除括号/括号之间的所有非数字字符?(How to remove all non numeric characters between brackets/parentheses with a regex?)

根据OP的评论,没有不平衡的或逃避的报价。 牢记这一点是一个单一的replaceAll方法调用来实现这一点: String repl = input.replaceAll("(?:\\D(?=[^(]*\\))|\\)\\s*)", ""); //=> hello 123 使用积极的向前看,我们使用先行\\D(?=[^(]*\\))找到括号内的所有非数字,然后我们移除)然后在可选空格中交替。 RegEx演示 As per comment from OP there are no unbalan...

正则表达式匹配不在方括号内的括号(Regex match parenthesis that are not within square braces)

(?:[^[]|^)\(([\w]*)\)(?!\]) 在Debuggex上实时编辑 不确定你在寻找什么,但这就是它的样子! 新编辑: (?:[^[]|^)?\((.*)\)(?!\]) 在Debuggex上实时编辑 编辑3: (?:[^[]|^)\((.*?)\)(?:(?!\])) 在Debuggex上实时编辑 (?:[^[]|^)\(([\w]*)\)(?!\]) Edit live on Debuggex Not really sure what you are looking f...

正则表达式匹配方括号后跟括号,其中方括号也可以包含其他方括号(Regex matching square brackets followed by parenthesis where the square brackets can also contain other square brackets)

干得好。 preg_match_all("~ \[( # open outer square brackets and capturing group (?: # open subpattern for optional inner square brackets [^[\]]* # non-square-bracket characters \[ # open inn...

使用正则表达式查找方括号之间的值[重复](Using regex to find value between square brackets [duplicate])

你可以使用下面的正则表达式, \[.*?\][^\]]*\] DEMO 你的代码是, <?php $str = "This is a test string. I want to get value between [this] and [/this]"; $regex = '~\[.*?\][^\]]*\]~'; if (preg_match($regex, $str, $m)) { $yourmatch = $m[0]; echo $yourmatch; } ?> ...

相关文章

更多

Create a Bootable MicroSD Card

http://gumstix.org/create-a-bootable-microsd-card.h ...

Android EditText软键盘显示隐藏以及“监听”

一、写此文章的起因 本人在做类似于微信、易信等这样的聊天软件时,遇到了一个问题。聊天界面最下面一般类似 ...

His New Line Of High-End Gucci Handbags Gets Many Things Right On Its Inaugural Outing

I was open and honest about my love for the beautif ...

Hadoop源码分析HDFS ClientProtocol——create

ClientProtocol负责完成HDFS Client与NameNode之间的交互。本文主要分析一 ...

merge solr index &&&&& very import create new core

http://wiki.apache.org/solr/MergingSolrIndexes http ...

启动Solr服务报错:Path must not end with / character

今天在第一次对Solr的UI Console进行Add Core操作的时候,用了默认选项,提交后页面无 ...

基于Lucene 4.x的ik-analyzer

需要修改IKAnalyzer.java、IKTokenizer.java、IKTokenizerFac ...

《X战警3:最后之战》(X-Men The Last Stand)[TC]

中文名称:X战警3:最后之战 英文名称:X-Men The Last Stand 别名:变种特攻3 ...

微信公众号接口添加菜单时错误(errcode":40017 invalid button type)

POST提交时总是报错: {&quot;errcode&quot;:40017,&quot;errms ...

《wordpress插件制作视频教程》(How to create a wordpress plugin)全5集更新完毕[HDTV]

中文名: wordpress插件制作视频教程 英文名: How to create a word ...

最新问答

更多

sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)

否(它不会使它们无法访问),是(您可以在没有停机的情况下运行它)。 sp_updatestats可以在没有停机的情况下针对实时数据库运行。 No (it doesn't make them inaccessible), and Yes (you can run it without downtime). sp_updatestats can be run against a live database without downtime.

如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)

最终,我们选择了使用Spark Framework for Java实现的后端REST API。 这可能不是最强大的,用户反馈一直是个问题。 我们将命令行界面拆分为提交REST调用,并将结果显示给用户。 Ultimately, we chose to go the route of having a backend REST API that was implemented with the Spark Framework for Java. This may not be the most r

AESGCM解密失败的MAC(AESGCM decryption failing with MAC)

您不能将Encoding.UTF8.GetString应用于任意二进制数据。 它只能解码使用UTF-8编码字符串的结果的字节。 .net实现将默默地破坏数据,而不是默认情况下抛出异常。 您应该使用Base64: Convert.FromBase64String和Convert.ToBase64String You can't apply Encoding.UTF8.GetString to arbitrary binary data. It can only decode bytes that

Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)

我希望能看到更多你的Sass代码等,但我的猜测是你需要在所有嵌套行上使用nest行为。 在我看来,基金会在Sass中的行主要是为了在一个层面上使用。 嵌套在另一行中的任何行都应使用nest行为,除非您希望在列上添加额外的填充。 在你的CodePen中,我能够通过向所有行添加一类collapse来修复列上填充的问题,我认为这与执行$behavior: nest相同$behavior: nest在Sass中$behavior: nest :

湖北京山哪里有修平板计算机的

京山有个联想的专卖店,那里卖平板电脑,地址在中百前面的十字路口右拐 ,他们应该会提供相关的维修服务。

SimplePie问题(SimplePie Problem)

我怀疑由于内容的性质(包含代码),stackoverflow提要不起作用。 我使用许多feed解析器看似“正常”的feed有类似的问题,尽管我最近运气最多的是Zend_Feed。 试试吧 I suspect the stackoverflow feed is not working due to the nature of the content (contains code). I have had similar issues with seemingly "normal" feeds us

在不同的任务中,我们可以同时使用多少“上下文”?(How many 'context' we can use at a time simultaneously in different tasks?)

是的,您可以通过getApplicationContext()任意数量的时间(后台任务), getApplicationContext()仅返回应用程序的context 。 Yes, you can pass getApplicationContext() any number of time (Background Tasks ) you want, getApplicationContext() simply returns context of the application.

HTML / Javascript:从子目录启用文件夹访问(HTML/Javascript: Enabling folder access from a subdirectory)

这是我最终做的事情: 我无法以这种方式提供完全访问权限,而是在project level folder中设置了一个虚拟HTML页面,该页面单击自身以重定向到位于separate, non-project util folder的HTML文件。 这允许我保留除了那个之外的所有内容,非常小的文件分开但不存在文件访问问题。 Here is what I ended up doing: I wasn't able to provide full access exactly this way, but

为什么我会收到链接错误?(Why do I get a linker error?)

看起来您的编译器错误地将名称引入到全局名称空间中,而不是C ++ 11 3.5 / 7中指定的最内层名称空间( Bushman ): 如果没有找到具有链接的实体的块范围声明来引用某个其他声明,那么该实体是最内层封闭名称空间的成员。 代码按照预期在GCC上编译: http : //ideone.com/PR4KVC 你应该能够通过在构造函数的块作用域中声明它之前(或代替它)在正确的名称空间中声明该函数来解决该bug。 但是,我无法访问您的编译器来测试它。 It looks like your co

如何正确定义析构函数(How to properly define destructor)

在C ++中,你需要手动释放内存。 没有垃圾收集器。 您显然需要在析构函数内手动释放内存。 如果您使用new分配内存,则需要对在deconstructor中使用new分配的每个资源使用delete ,例如: class1::~class1(void) { delete resource1; delete resource2; etc... } In C++ you need to free the memory manually. There's no garbage