0

I am learning about regular expressions and don't know how to write a regular expression for selecting a whole string which can consist of any character.

For example string like " Happy coding_programming with-C"

2 Answers2

1

Such a regex could look like:

.*

"." accepts any character (as comments suggest: the meaning of "." might be different; depending on the actual regex implementation you are looking at; but most often, "any character" boils down to "." )

"*" accepts that 0 to n times

GhostCat
  • 137,827
  • 25
  • 176
  • 248
0
.*

. is any character
* is 0 or more times
TolMera
  • 452
  • 10
  • 25