Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mail ID using Regular Expression
#1
Solved: 11 Years, 4 Months, 3 Weeks ago Big Grin 
Hi all,

Can we control the number of characters through the regular expression
For example i want only 7 characters in first part of the mail id(before @ symbol)

How can we write the regular expression for that?

regards,
asisha
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Code:
Length(Split("someone@domain.com", "@")(0)) = 7
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi..
Since you have asked this under Regular expression...We can do as given below...

Code:
Set myReg = New RegExp
myReg.Global = True
myReg.IgnoreCase = True

myReg.Pattern = "[a-z0-9]{2,7}@gmail.com" ' Here i just assumed that before @ we can have 2 min chars and max 7 chars. If u need 'to have only 7 then wirte like {7}

'returns true as no of chars 4
msgbox myReg.Test("test@gmail.com")

'returns false. as 1 char
msgbox myReg.Test("t@gmail.com")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
At Regular Expressions for e-mail address ganesh.dengale 6 19,270 08-23-2022, 02:51 PM
Last Post: ahmad3029
  Need Any digit in xpath path using Regular expression Priyam 1 3,519 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,390 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,854 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,632 12-08-2014, 06:38 PM
Last Post: anshika.agarwal

Forum Jump:


Users browsing this thread: 1 Guest(s)