• Post Reply Bookmark Topic Watch Topic
  • New Topic

using wildcards in java  RSS feed

 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have been going through the java regular expression manuals.
all i need to do is to check if the entered sip id is correct or not.

for example:

there will be a sip id like ( sip:bharani@192.168.110.120 )

i need to check whether the entered value is in that format.

how can i check that.

i googled it, i got examples for how to check of the id is between 255.255.255.255 but not for checking the format.


kindly help


thanks in advance
 
vaib saxena
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi bharani,

Test this

sip:[a-z,A-Z]*@\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b


This may work for you
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Vaib Saxena
 
vaib saxena
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Campbell Ritchie ....
 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you vaib.

i will try and let you know the status..




thank you
 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi vaib,

i'm new to java.
can you just tell me how to implement that.

should be that in a seperate method or in a class.
should i import anything to make it work.

i have to check if the entered address is of that form.

how to proceed.

thanks in advance
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bharani rao wrote:can you just tell me how to implement that.

Check out java.util.regex.Pattern and java.util.regex.Matcher. Or perhaps easier, java.lang.String#matches(java.lang.String).
 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you rob..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!