indiedev91
(Indie Dev 91)
August 29, 2022, 5:56am
1
I am trying to learn string manipulation and want to extract email ids from strings
For example: “Hello there, this is my email address sagarrawl7764@gmail.com , please send me the document”
How do I extract the email without using regex or any predefine functionalities similar to regex?
1 Like
@indiedev91
If you are not using Regex
then fallow these steps.
1- Split string with space value. It will break your string and all the words will go in in string type array.
2-loop over string array.
3- use string. contains over each iteration and check that its contains "@gamail.com , @outlook.com , and so on.
Note: Its work in case of general case, email can be from different domain. Its not reliable than Regex. Regex is perfect
1 Like
Gokul001
(Gokul Balaji)
August 29, 2022, 6:10am
3
Why you don’t need regex expression @indiedev91
Regards
Gokul
indiedev91
(Indie Dev 91)
August 29, 2022, 6:13am
4
Trying to learn string manipulation, trying to make projects as logical as possible without using predetermined methods
I will start using methods after some time
Gokul001
(Gokul Balaji)
August 29, 2022, 6:15am
5
Hi @indiedev91
Have a look on the tutorial for String Manipulation
Hi,
if you are a beginner in the world of automation and would like to know how you can manipulate text based on the solutions available in the VB.NET code and using REGEX (regular expressions) then you are in the right place.
In the topic below, you will learn how to easily extract data from any part of the search text using various methods.
The topic includes solution examples with descriptions and graphics to better understand the topic for functions such as:
Split
Substring
Left
Right
R…
Hope this will help you
Regards
Gokul
indiedev91
(Indie Dev 91)
August 29, 2022, 6:16am
6
thanks for the answer i wiill try that
and im just learning string manipulation, eventualkly i will use regex in production
1 Like
@indiedev91 Great. You will become master, you are thinking with different way and you have curiosity that’s amazing
1 Like
Gokul001
(Gokul Balaji)
August 29, 2022, 6:18am
8
Regex Expression @indiedev91
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=email\saddress\s)(\S+)(?=,)").Tostring
Regards
Gokul
Hey @indiedev91 ,
Have a look on this thread.
Thanks,
Sanjit
indiedev91
(Indie Dev 91)
August 29, 2022, 6:25am
11
i dont want to use regex right now
@indiedev91 yes use my suggestion
Hello @indiedev91 ,
Try this method it may help for you
Split(YourString," ")
You ca use the split string and loop it using for each loop , you can split each string.
Within loop , use if condition for isolate the string contains “@” “.”
item.ToString.Contains("@") And item.ToString.Contains(".")
KIndly refer this flow of XAML file.
EmailString_Manipulation.xaml (9.3 KB)
1 Like
Veera_Raj
(Veeraraj Sethuraman)
August 29, 2022, 6:52am
14
the regex is only easy way and dynamic also if you go with string manipulation you cant get efficient
+@([\w-]+.)+[\w-]{2,4}$
this following regex you can use for email
Yoichi
(Yoichi)
August 29, 2022, 7:13am
15
Hi,
FYI, more strict approach:
validMailCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&’*+-/=?^_`{|}~."
validDomainCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-."
Then check if valid character as address and domain before/after @ character.
Sequence2.xaml (10.8 KB)
Regards,
system
(system)
Closed
September 1, 2022, 7:36am
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.