At this moment in time, i posted something earlier asking about the same type of question regarding Regex. It has given me headaches, i have looked up loads of documentation of how to use regex but i still could not put my finger on it. I wouldn't want to waste another 6 hours looking to filter simple (i think) expressions.
So basically what i want to do is filter all filetypes with the endings of HTML extensions (the '*' stars are from a Winforms Tabcontrol signifying that the file has been modified. I also need them in IgnoreCase:
.html, .htm, .shtml, .shtm, .xhtml
.html*, .htm*, .shtml*, .shtm*, .xhtml*
Also filtering some CSS files:
.css
.css*
And some SQL Files:
.sql, .ddl, .dml
.sql*, .ddl*, .dml*
My previous question got an answer to filtering Python files:
.py, .py, .pyi, .pyx, .pyw
Expression would be: \.py[3ixw]?\*?$
But when i tried to learn from the expression above i would always end up with opening a .xhtml only, the rest are not valid.
For the HTML expression, i currently have this: \.html|.html|.shtml|.shtm|.xhtml\*?$ with RegexOptions.IgnoreCase. But the output will only allow .xhtml case sensitive or insensitive. .html files, .htm and the rest did not match. I would really appreciate an explanation to each of the expressions you provide (so i don't have to ask the same question ever again).
Thank you.
*in wildcards stands for any 0 or more chars. You probably want(?i)\.[xs]?htm\w*$,(?i)\.css\w*$and(?i)\.py\w*$/(?i)\.py[3ixw]?$. Note you still do not escape all.s.\.html|.html|.shtml|.shtm|.xhtml\*?$wouldn't work because everything else than.xhtmlhad the.escaped?SQL filesi mentioned above. I tried out this expression:\.[a-zA-Z]+$. Would that be a correct way to implement? Or is there another efficient way? Thanks again..sq3extension, then, you need to add digits to the regex,\.[a-zA-Z0-9]+$