Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于简单模式的Java正则表达式_Java_Regex - Fatal编程技术网

用于简单模式的Java正则表达式

用于简单模式的Java正则表达式,java,regex,Java,Regex,我想用Java编写一个正则表达式来过滤如下字符串:FROM:User。0@asdd.tst.com 我要筛选的内容如下所示: ["FROM" on beginning of the line] [undefinied number of white space character] [":" colon] [undefinied number of white space character] [any alphanumeric character plus any point(".")

我想用Java编写一个正则表达式来过滤如下字符串:
FROM:User。0@asdd.tst.com

我要筛选的内容如下所示:

["FROM" on beginning of the line] [undefinied number of white space character] [":" colon] [undefinied number of white space character] [any alphanumeric character plus any point(".") character) "] ["@" at] [any alphanumeric character plus any point(".") character) "] ["end of line character"] [“FROM”在行首] [未定义的空白字符数] [“:“冒号] [未定义的空白字符数] [任何字母数字字符加上任何点(“.”字符)] [“@”at] [任何字母数字字符加上任何点(“.”字符)] [“行尾字符”]
我已经尝试过这个:
^FROM\\s*:\\s*\\.*@\\.
,但它不起作用。(我使用了双斜杠,因为我想将其传递给类似字符串的模式。)

您忘记了字母数字字符:

^FROM\s*:\s*[a-zA-Z0-9.]+@[a-zA-Z0-9.]+

您忘记了字母数字字符:

^FROM\s*:\s*[a-zA-Z0-9.]+@[a-zA-Z0-9.]+