boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Java Regular Expression Question
相关主题
return null or empty list/set/...
请教 class cast problem
Re: Regular Expression in Java
谁用过JAVA1.4带的REGULAR EXPRESSION PACKAGE吗
[转载] Java Regular Expression Question //bow !
Re: [转载] Java Regular Expression Questio
Regular Expression question: how to enumerate all matches?
请教String.split的regular expression
EJB2 Question
1 quick interview question
相关话题的讨论汇总
话题: java话题: varname话题: expression话题: regular话题: string
进入Java版参与讨论
1 (共1页)
T*****e
发帖数: 361
1
In Perl, separating words with mixed caps in an identifier
like "RuntimeException" as "Runtime Exception" is fairly
easy. The regular expression for this can be:
$varName =~ s/([A-Z])/ \1/g;
or even better:
$varName =~ s/([^A-Z])([A-Z])/\1 \2/g;
$varName =~ s/([A-Z])([A-Z][a-z])/\1 \2/g;
Java's regular expression is pretty close to that of Perl
in term of searching for a pattern. However, can we do
similar replacement in Java without having to write a loop
to do searching and manua
m******t
发帖数: 2416
2
String.replaceAll()?
T*****e
发帖数: 361
3
I guess not if I understand it correctly.
String.replaceAll(String regex, String replacement)
The first parameter is for pattern searching, but the replacement
is simply a plain string and backreference does not work.

【在 m******t 的大作中提到】
: String.replaceAll()?
T*****e
发帖数: 361
4
I guess not if I understand it correctly.
String.replaceAll(String regex, String replacement)
The first parameter is for pattern searching, but the replacement
is simply a plain string and backreference does not work.

【在 m******t 的大作中提到】
: String.replaceAll()?
1 (共1页)
进入Java版参与讨论
相关主题
1 quick interview question
what is your opinion in this case?
对 spring 的 exception 处理方式真是不适应
其实有很多概念都是误导性的
EJB ConnectionFactory issue
Re: How can I call another program from Java?
Java runtime?
Re: 怎么能是JAVA里的数组开的更大?
Re: The real Risk
Re: unix环境下如何在java程序中执行命令行?
相关话题的讨论汇总
话题: java话题: varname话题: expression话题: regular话题: string