国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|JAVA教程|ASP教程|

服務器之家 - 編程語言 - JAVA教程 - Freemaker Replace函數的正則表達式運用

Freemaker Replace函數的正則表達式運用

2020-03-12 11:14jerrylsxu JAVA教程

這篇文章主要介紹了Freemaker Replace函數的正則表達式運用 的相關資料,需要的朋友可以參考下

replace(param1,param2,param3)

param1 正則表達式;param2 將匹配的字符替換成指定字符;param3 模式

param3 參數如下

 

模式 i r m s c f
replace 支持 支持 只和r 組合 只和r 組合 只和r 組合 支持

 

 

 



模式解釋:

i: Case insensitive: 忽略大小寫

f: First only. That is, replace/find/etc. only the first occurrence of something.

r: The substring to find is a regular expression.標準正則表達式(http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html )

m: Multi-line mode for regular expressions. In multi-line mode the expressions ^ and $ match just after or just before, respectively, a line terminator or the end of the string. By default these expressions only match at the beginning and the end of the entire string. Note that ^ and $ doesn't match the line-break character itself.

s: Enables dot-all mode for regular expressions (same as Perl singe-line mode). In dot-all mode, the expression . matches any character, including a line terminator. By default this expression does not match line terminators.

c: Permits whitespace and comments in regular expressions.在正則表達式中允許空格和注釋。

范例如下:

?
1
2
3
4
5
6
7
<#assign s = 'foo bAr baar'>
${s?replace('ba', 'XY')}
i: ${s?replace('ba', 'XY', 'i')}
if: ${s?replace('ba', 'XY', 'if')}
r: ${s?replace('ba*', 'XY', 'r')}
ri: ${s?replace('ba*', 'XY', 'ri')}
rif: ${s?replace('ba*', 'XY', 'rif')}

輸出結果:

foo bAr XYar
i: foo XYr XYar
if: foo XYr baar
r: foo XYAr XYr
ri: foo XYr XYr
rif: foo XYr baar 

更多范例:

原文:str = 2積分兌換30元優惠券

${str?replace('\\b\\d+積分','','r')}

輸出:兌換30元優惠券

ps:freemarker的replace功能

替換字符串 replace 

?
1
2
${s?replace(‘ba', ‘XY' )}
${s?replace(‘ba', ‘XY' , ‘規則參數')}

將s里的所有的ba替換成xy 規則參數包含: i r m s c f 具體含義如下: 

· i: 大小寫不區分. 
· f: 只替換第一個出現被替換字符串的字符串 
· r:  XY是正則表達式 

· m: Multi-line mode for regular expressions. In multi-line mode the expressions ^ and $ match just after or just before, respectively, a line terminator or the end of the string. By default these expressions only match at the beginning and the end of the entire string. 

· s: Enables dotall mode for regular expressions (same as Perl singe-line mode). In dotall mode, the expression . matches any character, including a line terminator. By default this expression does not match line terminators. 

· c: Permits whitespace and comments in regular expressions. 

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 黄视频网站免费观看 | 久久久久综合狠狠综合日本高清 | 亚洲欧美另类在线 | 精品国产乱码久久久久久1区2区 | 欧美另类国产 | 喷水av| 四季久久免费一区二区三区四区 | 综合伊人久久 | 中文字幕在线观看av | 亚洲欧美日韩另类精品一区二区三区 | 天堂久久爱资源站www | 国产亚洲精品久久久久久久久 | 精品在线看 | 亚洲自拍另类 | 欧美一级在线视频 | 黄色在线免费看 | 精品视频一区二区 | 一区视频在线 | 一区二区日本 | 国产综合亚洲精品一区二 | 亚洲精品一区中文字幕乱码 | 国产一区二区三区免费播放 | 日韩欧美三区 | 日韩性视频 | 99精品视频免费观看 | 一区二区三区在线 | 午夜在线 | 亚洲高清一区二区三区 | 中文字幕免费看 | 国产精品1区2区 | 欧美在线观看免费观看视频 | 欧美一区二区三区xxxx监狱 | 国产在线不卡观看 | 日韩城人免费 | 久久成人国产精品 | 国产精品久久久久久久久久久小说 | 亚洲卡一 | 成人av在线一区二区 | 国产一区二区三区欧美 | 日韩欧美视频免费在线观看 | 成人av播放 |