Quantcast
Channel: THWACK: Message List - Network Configuration Manager
Viewing all articles
Browse latest Browse all 8827

Re: Regex and Fortinets

$
0
0

With regex's you need to accommodate for white-spaces and the like.   In Fortinet configs there are frequently white-space before the actual command happens.   Using '^' anchors the regex to the beginning of the line.

 

So, what you probably really want to use for something like that is "^\s*set pre-login-banner enable" to allow for as many white-space characters before the actual "set" command happens.   If you want the line to terminate after "enable", add a "$" at the end to make sure the line ends there.

 

A nice and easy way to see if your reg-ex's work is to edit the file using the GVIM editor in windows.   Put in a "/" to search followed by your regex, it will highlight occurrences in yellow that match.


Viewing all articles
Browse latest Browse all 8827

Trending Articles