Votre motif ne correspond pas à un positionnement incorrect de ^
.
^
sélectionnne le début d'une chaîne sauf si vous utilisez Mode modifier
ou autre options
.
Essayez cette
(?im)^(\d+)\b
Explication
<!--
(?im)^(\d+)\b
Match the remainder of the regex with the options: case insensitive (i);^and $ match at line breaks (m) «(?im)»
Assert position at the beginning of a line (at beginning of the string or after a line break character) «^»
Match the regular expression below and capture its match into backreference number 1 «(\d+)»
Match a single digit 0..9 «\d+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Assert position at a word boundary «\b»
-->
merci, cela fonctionne pour moi. '^ (\ d +)' –
Si vous voulez spécifiquement les deux premiers chiffres s'il y a un nombre plus long, vous pouvez utiliser '^ (\ d {1,2})' ou de façon équivalente '^ (\ d \ d?)' – tripleee