I'm trying to see if there is an entry for some input in a file, so I'm using a regular expression to query each line:
cat $file | where {$_ -match "^script\$fileName -*"}
where $fileName is some input defined elsewhere.
How do I alter the regex to interpolate the variable instead of matching for '$fileName' ?
$. Try leaving out the backslash. If you want to match a literal backslash, add a second backslash instead (to escape the backslash).