Thread Regex Doku Frage (15 answers)
Opened by Kuerbis at 2024-02-10 17:39

Kuerbis
 2024-02-10 17:39
#195870 #195870
User since
2011-03-20
947 Artikel
BenutzerIn
[default_avatar]
Hallo,

welche dieser drei s///e würdet ihr für ein Beispiel in einer Dokumentation verwenden?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
From "M/d/yyyy" to "yyyy-MM-dd":

    id | date                  id | num
    ---|----------             ---|-----------
     1 | 1/14/2003              1 | 2003-01-14
    ---|----------             ---|-----------
     2 | 7/28/2004              2 | 2004-07-28
    ---|----------             ---|-----------
     3 | 11/8/2005              3 | 2005-11-08


Code (perl): (dl )
s/(\d+)\/(\d+)\/(\d+)/sprintf '%d-%02d-%02d',$3,$1,$2/e


Code (perl): (dl )
s/^(\d+)\/(\d+)\/(\d+)/sprintf '%d-%02d-%02d',$3,$1,$2/e


Code (perl): (dl )
s/^(\d+)\/(\d+)\/(\d+)$/sprintf '%d-%02d-%02d',$3,$1,$2/e

View full thread Regex Doku Frage