A line has to be validated through regex,
line can contain any characters, spaces, digits, floats.
line should not be blank
I tried this:
[A-Za-z0-9~`!#$%^&*()_+-]+ //thinking of all the characters
Any alternative solution will be helpful
Try this to match a line that contains more than just whitespace
/.*\S.*/
This means
/
= delimiter.*
= zero or more of anything but newline\S
= anything except a whitespace (newline, tab, space)
so you get
match anything but newline + something not whitespace + anything but newline
if whitespace only line counts as not whitespace, then replace the rule with /.+/
, which will match 1 or more of anything.
try:
.+
The . matches any character, and the plus requires least one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With