Index: Gruntfile.js
===================================================================
--- Gruntfile.js	(revision 38086)
+++ Gruntfile.js	(working copy)
@@ -591,6 +591,36 @@
 				dest: '.'
 			}
 		},
+		replace: {
+			emojiRegex: {
+				options: {
+					patterns: [
+						{
+							match: /\/\/ START: emoji regex[\S\s]*\/\/ END: emoji regex/g,
+							replacement: function () {
+								var twemoji = grunt.file.read( SOURCE_DIR + 'wp-includes/js/twemoji.js' );
+								var found = twemoji.match( /re = \/(.*)\/g,/ );
+								var emojiRegex = found[1];
+
+								// Magically transform emojiRegex into a PHP-friendly regex here.
+
+								return "// START: emoji regex\n\treturn 'lol';\n\t// END: emoji regex";
+							}
+						}
+					]
+				},
+				files: [
+					{
+						expand: true,
+						flatten: true,
+						src: [
+							SOURCE_DIR + 'wp-includes/formatting.php'
+						],
+						dest: SOURCE_DIR + 'wp-includes/'
+					}
+				]
+			}
+		},
 		_watch: {
 			all: {
 				files: [
@@ -687,6 +717,10 @@
 		'phpunit'
 	] );
 
+	grunt.registerTask( 'precommit:emoji', [
+		'replace:emojiRegex'
+	] );
+
 	grunt.registerTask( 'precommit', 'Runs test and build tasks in preparation for a commit', function() {
 		var done = this.async();
 		var map = {
@@ -752,6 +786,11 @@
 							taskList.push( 'precommit:' + extension );
 						}
 					} );
+
+					if ( [ 'twemoji.js' ].some( testPath ) ) {
+						grunt.log.writeln( 'twemoji.js has updated. Running `precomitt:emoji.' );
+						taskList.push( 'precommit:emoji' );
+					}
 				}
 
 				grunt.task.run( taskList );
Index: package.json
===================================================================
--- package.json	(revision 38086)
+++ package.json	(working copy)
@@ -27,6 +27,7 @@
     "grunt-legacy-util": "^0.2.0",
     "grunt-patch-wordpress": "~0.4.0",
     "grunt-postcss": "~0.7.1",
+    "grunt-replace": "~1.0.1",
     "grunt-rtlcss": "~2.0.1",
     "grunt-sass": "~1.1.0",
     "matchdep": "~1.0.0"
Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 38087)
+++ src/wp-includes/formatting.php	(working copy)
@@ -5209,6 +5209,24 @@
 }
 
 /**
+ * Returns a regex string to match all emoji that WordPress recognises.
+ *
+ * This regex is automatically built from the regex in twemoji.js - if it needs to be updated,
+ * you should update the regex there, then run the `grunt precommit:emoji` job.
+ *
+ * @since 4.6.0
+ *
+ * @return string A regex to match all emoji that WordPress recognises.
+ */
+function wp_emoji_regex() {
+	// Do not remove the START/END comments - they're used to find where to insert the regex.
+
+	// START: emoji regex
+	return 'lol';
+	// END: emoji regex
+}
+
+/**
  * Shorten a URL, to be used as link text.
  *
  * @since 1.2.0
