给定一个字符串,例如

September 3  September 3  September 2  September 1 September 10 August 14


我想输出

September 03  September 03  September 02  September 01 September 10 August 14


尝试了一些没有运气的正则表达式:/

最佳答案

使用这个简单的模式

\b(\d)\b


并更换瓦特/

0$1


Demo

#    \b(\d)\b
\b              # <word boundary>
(               # Capturing Group (1)
  \d            # <digit 0-9>
)               # End of Capturing Group (1)
\b              # <word boundary>

10-08 16:49