I would like to skip the comments using javascript. I can only get the reverse, meaning not skipping the comments. The following syntax:
#GSM settings\r\n <----- Skip these
Apn internet\r\n
Pass \r\n
User \r\n
Pin \r\n
Dial *99#\r\n
KeepAlive 0\r\n
#ETH TEST\r\n <---- skip
Mac 00:60:37:12:34:56\r\n
EthIpv4 192.168.0.10\r\n
Subnet 255.255.255.0\r\n
Gwip 192.168.0.1\r\n
Autoip 0\r\n
I am not sure I understood 100%, if you want to match rows that are not starting with a “#”, you can do it like this:
This matches only if after the start of the string there is not “#” directly following.
See it here at Regexr
(?!#)is a negative lookahead assertion, that fails if there is a “#” following this position. Since it is after the^anchor, the whole expression will fail, if the first character is a “#”.If there can be whitespaces before the “#”, you can add them like this:
See it here on Regexr