in this video we will see how to extract
numbers or alphabets from a string I
created a test project let's create a
package package name let's say comm test
let's create a class
class name let's say test string
let's run this class
see it is printing hello world
now let's say input in the form of a
mixture of numbers and alphabets
here is the output which I want
so only alphabets
of input as an input string
now let's see how to extract only
alphabets
here is the simplest way using regex we
can easily replace numbers with an empty
string now I don't want numbers to use
regex like inside square bracket range
must be 0 to 9
let's run
see it is not including numbers and
printing only alphabets see this is very
simple so no matter what size of the
string is you can easily remove numbers
now let's say I don't want alphabets
only numbers should come so here is the
output which I want
now just we need to add XOR operator
before zero to nine
let's run
see it is working so instead of doing
all nonsense code use regex if you want
to remove something from string
I hope you like this video then press
the like button thanks for watching