c如果您想要看起来像浮点数的东西,请使用
regexp :3360 commonmodulefromcpan瘙痒Perl通过咳嗽正规数据集实现了这一点:
$ perl-mregexp :3360通用- le ' print $ re { num } { real }
(? (? I ) ) )?[ -]? () )? (?=[.]? [0123456789] (?[0123456789]* )? (?[.] () ) ) (?[0123456789]{0,}? () )? (?[E] )? (?[ -]? () )?[0123456789] )|)
可以根据需要进行调整,这给你一个基本的想法
非常灵活。 例如,它吐出base-2实数的模式,每三个位置允许逗号。
$ perl-mregexp 33603360 common-le ' print $ re { num } { real } {-base=2} {-sep=',' }{-group=3} '
(? (? I ) ) )?[ -]? () )? (?=[.]? [01] () ), 3360 [ 01 ] { 1,3 }? (?[,]([01]{3} ) ) ) ) ) ) ) (? (?[.] () ) ) (?[01]{0,} )? () )? (?[E] )? (?[ -]? () )?[01] ) (|)
根据documentation,可以吐出的数值模式的完整可能语法如下。
$ re { num } { int } {-base } {-sep } {-group } {-places }
$ re { num } { real } {-base } {-radix } {-places } {-sep } {-group } {-expon }
$ re { num } { dec } {-radix } {-places } {-sep } {-group } {-expon }
$ re { num } { oct } {-radix } {-places } {-sep } {-group } {-expon }
$ re { num } { bin } {-radix } {-places } {-sep } {-group } {-expon }
$ re { num } { hex } {-radix } {-places } {-sep } {-group } {-expon }
$ re { num } { decimal } {-base } {-radix } {-places } {-sep } {-group }
$RE{num}{square}
$RE{num}{roman}
根据真正想要的东西定制。 是的,当然可以在Java中使用这些模式。
祝您愉快。