正则表达式 – 在50,000个HTML页面中查找电话号码

前端之家收集整理的这篇文章主要介绍了正则表达式 – 在50,000个HTML页面中查找电话号码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在50,000个HTML页面中找到电话号码?

Jeff Attwood posted 5 Questions for programmers applying for jobs:

In an effort to make life simpler for phone screeners,I’ve put together
this list of Five Essential Questions
that you need to ask during an SDE
screen. They won’t guarantee that your
candidate will be great,but they will
help eliminate a huge number of
candidates who are slipping through
our process today.

1) Coding The candidate has to write
some simple code,with correct Syntax,
in C,C++,or Java.

2) OO design The candidate has to
define basic OO concepts,and come up
with classes to model a simple
problem.

3) Scripting and regexes The
candidate has to describe how to find
the phone numbers in 50,000 HTML
pages.

4) Data structures The candidate has
to demonstrate basic knowledge of the
most common data structures.

5) Bits and bytes The candidate has
to answer simple questions about bits,
bytes,and binary numbers.

Please understand: what I’m looking
for here is a total vacuum in one of
these areas. It’s OK if they struggle
a little and then figure it out. It’s
OK if they need some minor hints or
prompting. I don’t mind if they’re
rusty or slow. What you’re looking for
is candidates who are utterly
clueless,or horribly confused,about
the area in question.

07000

注意:Steve Yegge最初提出了这个问题。

egrep "(([0-9]{1,2}.)?[0-9]{3}.[0-9]{3}.[0-9]{4})" . -R --include='*.html'

猜你在找的正则表达式相关文章