30 lines
857 B
Python
30 lines
857 B
Python
import re
|
|
|
|
# Test the regex used by ESP-IDF for esp-clang
|
|
regex = r"\([^\s]+\s+([0-9a-zA-Z\.\-_]+)\)"
|
|
|
|
# Apple clang version output
|
|
apple_clang_output = "Apple clang version 17.0.0 (clang-1700.0.13.5)"
|
|
|
|
# ESP-IDF clang version output
|
|
esp_clang_output = "Espressif clang version 18.1.2 (https://github.com/espressif/llvm-project.git esp-18.1.2_20240912)"
|
|
|
|
print("Testing regex:", regex)
|
|
print("\nApple clang output:")
|
|
print(apple_clang_output)
|
|
match = re.search(regex, apple_clang_output)
|
|
if match:
|
|
print("Match found:", match.group(0))
|
|
print("Captured version:", match.group(1))
|
|
else:
|
|
print("No match found!")
|
|
|
|
print("\nESP-IDF clang output:")
|
|
print(esp_clang_output)
|
|
match = re.search(regex, esp_clang_output)
|
|
if match:
|
|
print("Match found:", match.group(0))
|
|
print("Captured version:", match.group(1))
|
|
else:
|
|
print("No match found!")
|