Une intervertion optionnelle de captures est malaisée en RE, mais voilà ce qu'on peut faire, qui doit couvrir tous les cas envisagés :
Code : Tout sélectionner
Local $aHtml[4] = [ _
'Your IP: 82.000.00.102<br>Please, this is only for test, use with moderation! If you want to get the PHP source code: <a href="http://www.witracks.com.br/gmaps.txt">http://www.witracks.com.br/gmaps.txt</a><br>l o n = 78.462173 <br> l A T = 17.416467', _
'Your IP: 82.000.00.102<br>Please, this is only for test, use with moderation! If you want to get the PHP source code: <a href="http://www.witracks.com.br/gmaps.txt">http://www.witracks.com.br/gmaps.txt</a><br> lo n = 78.462173 <br> LA t = 17.416467', _
'Your IP: 82.000.00.102<br>Please, this is only for test, use with moderation! If you want to get the PHP source code: <a href="http://www.witracks.com.br/gmaps.txt">http://www.witracks.com.br/gmaps.txt</a><br> l A T = -17.416467<br>l o n = -78.462173 ', _
'Your IP: 82.000.00.102<br>Please, this is only for test, use with moderation! If you want to get the PHP source code: <a href="http://www.witracks.com.br/gmaps.txt">http://www.witracks.com.br/gmaps.txt</a><br>lon= 178.462173 <br> l A T= -0.4167 ' _
]
Local $lon, $lat, $Pos
For $html In $aHtml
$html = StringStripWS($html, 8)
$Pos = StringRegExp($html, "(?i:<br>lon=(-?\d*\.\d+)<br>lat=(-?\d*\.\d+)|<br>lat=(-?\d*\.\d+)<br>lon=(-?\d*\.\d+))", 1)
If Not @error Then
If UBound($Pos) = 2 Then
$lon = Number($Pos[0])
$lat = Number($Pos[1])
Else
$lon = Number($Pos[3])
$lat = Number($Pos[2])
EndIf
Else
; position non trouvée
$lon = "Nan"
$lat = "Nan"
EndIf
MsgBox(0, "Position", "Lat = " & $lat & @LF & "Lon = " & $lon)
Next
NB : la longitude va de -180° à 180°, donc sur trois chiffres. J'ai opté pour la possibilité que le site ne produise pas de zéro avant la virgule pour les angles < 1° en valeur absolue (e.g. -.12345 au lieu de -0.12345)
Edit : ai coupé dans la viande pour simplifier le pattern.
La cryptographie d'aujourd'hui c'est le taquin plus l'électricité.