Metacharacter '.' match any character.
Ex:
Regular expression '.{5}' match any continuous five characters.
Sample Output
Enter Regular Expression
.{5}
Enter the string
Hello How are you
I found the text Hello starting at index 0 Ending at index 5
I found the text How starting at index 5 Ending at index 10
I found the text are y starting at index 10 Ending at index 15
Enter the string
abrakadabra
I found the text abrak starting at index 0 Ending at index 5
I found the text adabr starting at index 5 Ending at index 10
Note
Use this program to
run above sample
No comments:
Post a Comment