It depends a lot on the variations that the String
of entry can have, and which characters you want to get.
The simplest case is:
(bits.*)
What gets bits
+ everything you have afterwards.
Only .*
means "zero or more occurrences of any character".
If you do not want some character types, or just want certain types (like letters, numbers, or spaces), or any other rule, you can restrict more by using something like Israel's response .
For example:
(bits[a-zA-Z0-9 ]*)
[a-zA-Z0-9 ]*
will get only letters, numbers, or space (zero or more occurrences of any of these characters). Change the expression according to what you need.
Depending on the regex engine and / or the language / API you use, .
may or may not consider line breaks ( \n
and \r
). Some APIs allow you to even configure this ( example ). I do not know if this applies to your case (since it was not specified), but it's a point of attention.