static $regex = '/&([\w]+);|&#([\d]+);|&#(x[0-9a-fA-F]+);|(&)/m' (line 3656)
1: Match any char-based entity. This will go in $matches[1] 2: Match any num-based entity. This will go in $matches[2] 3: Match any hex-based entry. This will go in $matches[3] 4: Match any ampersand that is not an entity. This goes in $matches[4] This last rule will only match if one of the previous two has not already matched. XXX: Are octal encodings for entities acceptable?
Static Method doReplacement (line 3680)
Static Method replaceAllEntities (line 3670)
This will scan a string and will attempt to replace all entities with their numeric equivalent. This will not work with specialized entities.
Static Method replaceEntity (line 3711)