FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Sasha_FTNT
Staff
Staff
Article Id 189895

Description
This article describes how to insert the question mark into regular expressions.

By default, the symbol '?' is used to show the help menu.
But sometime it is required inside the regular expressions. 
As the question mark makes the preceding token in the regular expression optional.


Solution
As the symbol of question mark is reserved to help menu, it will be impossible to copy-past or type this symbol into some expressions.

Here is the simple snippet from DLP sensor:

# config dlp sensor
    edit "default"
        set comment "Default sensor."
        # config filter
            edit 1
                set proto smtp pop3 imap http-post
                set filter-by regexp
                set regexp "(?s:(\\d{10}.*))"
                set action block
            next
        end
    next
end

To be able to insert this kind of symbols, open the Putty client and press 'Ctrl-V' first then input '?'.
Note: it will not allow to do it form the WebGUI CLI available on management page.


 

Contributors