@darrion.kuhn
To capture values with a space after a hyphen using regex, you can use the following regular expression pattern:
1
|
-s(w+) |
Explanation of the pattern:
Here is an example of how you can use this pattern in Python code to capture values with a space after a hyphen:
1 2 3 4 5 6 7 8 9 |
import re text = "example - value" pattern = r'-s(w+)' matches = re.findall(pattern, text) for match in matches: print(match) |
In this example, the re.findall()
function is used to search for all occurrences of the pattern in the text
variable. The captured values are then printed out.