I tried (\s|\t).*[\b\w*\s\b], this one is almost ok but I want also except lines with #.
#Name Type Allowable values
#========================== ========= ========================================
_absolute-path-base-uri String -
add-xml-decl Boolean y/n, yes/no, t/f, true/false, 1/0
As @anubhava said in his answer, it looks you just need to check for
#at the beginning of the line. The regex for that is simple, but the mechanics of applying the regex varies wildly, so it would help if we knew which regex flavor/tool you’re using (e.g. PHP, .NET, Notepad++, EditPad Pro, etc.). Here’s a JavaScript version:Notice the modifiers:
m(“multiline”) allows^and$to match at line boundaries, andg(“global”) allows you to find all the matches, not just the first one.Now let’s look at your regex.
[\b\w*\s\b]is a character class that matches a word character (\w), a whitespace character (\s), an asterisk (*), or a backspace (\b). In other words, both*and\blose their special meanings when the appear in a character class.\smatches any whitespace character including\t, so(\s|\t)is needlessly redundant, and may not be needed at all. What it’s actually doing in your case is matching the newline before each matched line. There’s no need for that when you can use^in multiline mode. If you want to allow for horizontal whitespace (i.e., spaces and tabs) before the#, you can do this:(?![ \t]*#)is a negative lookahead; it means “from this position, it is impossible to match zero or more tabs or spaces followed by#“. Coming right after the^line anchor as it does, “this position” means the beginning of a line.