<p>Excel ne prend pas en charge les regex nativement dans les formules. Vous avez deux options :</p>
<p><strong>Option 1 : UDF VBA</strong><br>
Créez une fonction personnalisée :</p>
<pre data-code-wrap="vba"><code class="lang-vba">Function RegexMatch(text As String, pattern As String) As String
Dim regex As Object
Set regex = CreateObject("VBScript.RegExp")
regex.Pattern = pattern
regex.Global = True
If regex.Test(text) Then
RegexMatch = regex.Execute(text)(0).Value
End If
End Function
</code></pre>
<p><strong>Option 2 : Dans une boucle VBA</strong></p>
<pre data-code-wrap="vba"><code class="lang-vba">Dim regex As Object
Set regex = CreateObject("VBScript.RegExp")
regex.Pattern = "\d+"
For Each cell In Range("A1:A100")
If regex.Test(cell.Value) Then
' traitement
End If
Next
</code></pre>