You can use regular expressions to remove any bullet or dash at the beginning of a string. Here's an example code snippet:
main.rb151 chars4 lines
In this example, sub
is used to substitute the matched pattern in the string with an empty string, effectively removing it. The regular expression (/^[*-]\s+/
) matches any string that starts with an asterisk or dash, followed by one or more whitespace characters. The ^
metacharacter denotes the start of the string.
gistlibby LogSnag