I have following string
Документ подписан аналогом собственноручной подписи Клиента (простой электронной подписью): [349522252]
[01.12.2019][8605]
Дата подписания: 01.12.2019
I need to extract date so result should be 01.12.2019. I fugured out how to extract something between [...]
(?<=\[)(.*?)(?=\])
CodePudding user response:
You can use
(?<=\[)\d{1,2}\.\d{1,2}\.\d{2}(?:\d{2})?(?=\])
See the regex demo.
Details:
(?<=\[)- a positive lookbehind that matches a location that is immediately preceded with a[char -\d{1,2}- one or two digits\.- a dot\d{1,2}\.- one or two digits and a dot\d{2}(?:\d{2})?- two or four digits(?=\])- a positive lookahead that matches a location that is immediately preceded with a]char.

