Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/346.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 regex模式中“$”的用法是什么?_Java_Regex - Fatal编程技术网

Java regex模式中“$”的用法是什么?

Java regex模式中“$”的用法是什么?,java,regex,Java,Regex,一个模式有这些$的用途,它有什么用途?是否与*类似 代码 如果您查看 边界匹配器 一行的末尾 $匹配正则表达式中字符串的结尾。根据文档,这与行的结尾匹配。 Pattern tempoPattern = Pattern.compile("s$"); Matcher tempoMatcher = tempoPattern.matcher(normalizado); Pattern bytesPattern = Pattern.compile("(k|m|g)b$");

一个模式有这些$的用途,它有什么用途?是否与*类似

代码


如果您查看

边界匹配器

一行的末尾


$匹配正则表达式中字符串的结尾。根据文档,这与行的结尾匹配。
    Pattern tempoPattern = Pattern.compile("s$");
    Matcher tempoMatcher = tempoPattern.matcher(normalizado);

    Pattern bytesPattern = Pattern.compile("(k|m|g)b$");