简体   繁体   中英

How to add zero in front of single digit values using REGEX in pentaho

I have the month values in a flat file like

Month
  12
  11
   1
   2
   8
  10

now i want to add zero in front of single digit values & double digit as same.

output should be like

Month
  12
  11
  01
  02
  08
  10

This am doing in PENTAHO (I will implement in Replace in string step)

I am not aware of PENTAHO. But following regex should work for most of the languages

Match : \\b([0-9])\\b

Replace : 0$1

regex101 demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM