-2

Need a RegEx to find word "CEO" and take next number group.

Example code:

<td>
<p>John Doe</p>
<p>CEO</p>
<p>tel. <a href="tel:152 444 9595">152 444 9595</a></p>
<p>john.doe@somethingdoejohn.com</p>
Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142
Doeboy
  • 1
  • which langauge ? and define number group precisely – Mustofa Rizwan Oct 27 '16 at 12:21
  • 2
    Welcome to Stack Overflow! Pure code-writing requests are off-topic on Stack Overflow -- we expect questions here to relate to *specific* programming problems -- but we will happily help you write it yourself! Tell us [what you've tried](http://stackoverflow.com/help/how-to-ask), and where you are stuck. This will also help us answer your question better. – Thomas Ayoub Oct 27 '16 at 12:23
  • 1
    [Don't parse HTML with regex](http://stackoverflow.com/a/1732454/2482744) – Alex Hall Oct 27 '16 at 12:25

1 Answers1

0

An easy example how to fetch the part "tel:152 444 9595"

CEO.*href="(tel:[0-9\s]*)">

Use tools like regexr.com (do not use data you do not want to share with others) if you want to play around with the regular expression. Also remove the new lines from the string to make it easier for matching.

.*         arbitrary sequence
[0-9\s]*   match numbers and whitespaces
()         use only this part in the result (depends on type of regex matching)
the rest is used literally at their positions