2017-11-13 12 views
1

私は私がグルーヴィーでReplaceAll nは

NTEST DESAの\とをRdestを交換するtriyingてる

を交換するパターンとscript.dslを持って

ジェンキンス2にjobDslで働いていますここに私の例

example="choiceListText('rDEST')" 
print ("example is ") 
println (example) 
exreplace = example.replaceAll("rDEST","desa\ntest") 
print ("exreplace is ") 
println (exreplace) 

コード結果は

example is choiceListText('rDEST') 
exreplace is choiceListText('desa 
test') 
です

は、私はトリプル引用されたシングル、ダブル引用し、トリプルには二重引用符で囲まれたが、STILカントはそれを成し遂げる、シングル引用してみた

exreplace is choiceListText('desa\ntest') 

を取得するために期待しています!

+0

これは実行可能でもありません。 – Opal

答えて

1

固定コード

example="choiceListText('rDEST')" 
print ("example is ") 
println (example) 
exreplace = example.replaceAll("rDEST","desa \\\\n test") 
print ("exreplace is ") 
println (exreplace) 

ので、この「\\」スラッシュ のためにこの「\\」他の1も予約文字

であり、私も持っていた\ nについてです私の答えを投稿するために3スラッシュを書く!

Marcelo Gastonに感謝Rebasti Peralta !!!