While using regular expressions, lookarounds allow us to create zero-width boundaries where the boundaries are also regular expressions. This will enable us to ensure that our primary expression either begins or ends with the provided lookaround or does _not_ begin or end with the provided lookaround. The expression in the lookaround is matched, but not captured, so the resulting match is only the non-lookaround text. This allows us to fine-tune our expressions and ensure we’re only matching what we want.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Remove excess spacing from `highstate` file.
Remove the additional spacing before each line in the
highstate
file.- Using regular expressions to provide the desired data.
Craft a regular expression that will result in only the
__id__
,__run_num__
, and__sls__
lines from thehighstate
file.- Create `sls-report.txt`.
Save the newly-generated list of information to
sls-report.txt
.