I need some deep knowledge Regex Vs Dom.

Is Regex much faster then Dom or not?

Like processing speed, reliable or not .

If any one share link or article it helpful for me.

Recommended Answers

All 4 Replies

It all depends on what you want to achieve. It is usually better to use the DOM for parsing HTML/XML. In few occasions where you can't load it due to parsing errors, a regular expression may get you there, but it can also cause a lot of headaches. Some things just are not possible with a regular expression.

Suppose i want to find anchor tag ->href value only from large file set no of files

so is reliable to go with Dom / Regex.
because Regex is faster then Dom in text processing

Do a speed test and find out. Using the DOM will be more reliable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.