MSZ
Apr 30, 2018Nimbostratus
RegExp Writing
Kindly elaborate the following Regular expression.
How it will work?
(.)+.(xlsx|docx)
Hi,
this expression will :
if you want the character before xlsx or docx is a dot, the expression must be :
(.)+\.(xlsx|docx)
If you want to store the name without extension, and not the first character, the expression must be :
(.+)\.(xlsx|docx)
If you don't want to store name value in match group, remove parenthesis:
.+\.(xlsx|docx)
If you don't want to store extension in match group, add ?: after the opening parenthesis
.+\.(?:xlsx|docx)
you can play with this on online services like this one