我试图抓取一个字符串的正好27个字符(原因并不重要)。
所以我用了正则表达式:.{27}
在此字符串"Joey Went to the Store and found some great steaks!"
结果为"Joey Went to the Store and "
Bingo正好是27个字符。
但是由于尾随空间,该结果导致我的程序出错。所以现在我需要在"和"之后采取结果并修剪空间。返回没有尾随空格的结果。最终结果必须是"Joey Went to the Store and"
。
这里是踢球者,我需要一个正则表达式的所有工作,因为应用程序只能应用1个正则表达式(真的是愚蠢的程序,但我坚持使用它)。
答案 0 :(得分:3)