0

Suppose i have file contains customer name Customer can write his/her name like a text message in any format.

Like:

Name: John (case 1)
Name : John   (case 2)
*Name=John    (case 3)
Name :- John  (case 4)
name :: John  (case 5)
Name ; John   (case 6)

Now how to write a regex that will always returns a name. If not then at least return 90% of the result. Cases could be endless

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
  • Looks like you are looking to create a regex, but do not know where to get started. Please check [Reference - What does this regex mean](https://stackoverflow.com/questions/22937618) resource, it has plenty of hints. Also, refer to [Learning Regular Expressions](https://stackoverflow.com/questions/4736) post for some basic regex info. Once you get some expression ready and still have issues with the solution, please edit the question with the latest details and we'll be glad to help you fix the problem. – Wiktor Stribiżew Aug 26 '20 at 12:58
  • Note that questions that ask ["Give me a regex that does X"](https://meta.stackoverflow.com/q/285733) with no attempt are off topic on Stack Overflow. – Wiktor Stribiżew Aug 26 '20 at 12:58
  • To augment Wiktor's comment: first specify the match rules, only then can you code the appropriate regex. – TonyR Aug 26 '20 at 13:20
  • I do know how to write a regex .*[nN][aA][mM][eE][\s\/\*:;=-]*.* this regex select what i want is know how to put if else condition in regex. so in future if i want the specific name then i can have. –  Aug 26 '20 at 13:27

0 Answers0