Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Created November 1, 2019 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeMyUI/145ce7c2878afb645ab33adc75fe985a to your computer and use it in GitHub Desktop.
Save CodeMyUI/145ce7c2878afb645ab33adc75fe985a to your computer and use it in GitHub Desktop.
Regex test on <input> value with reproCSS
<h1>Regex on input value</h1>
<input id=demo>
<p>This input will go red when the regular expression <code>/magic/gi</code> is met. So it should light up for any values that contain 'MAGIC' or 'magic'</p>
<style process="load input">
${/magic/gi.test(demo.value) && '#demo'} {
background: red;
}
</style>
<footer>Built with <a href=https://tomhodgins.github.io/reprocss/>reproCSS</a> </footer>
<script src="https://rawgit.com/tomhodgins/reprocss/master/reprocss.js"></script>
input {
padding: .25em;
width: 100%;
font-size: 14pt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment