Logo James's Peredutions
  • Home
  • About
  • Selected Projects
  • Accomplishments
  • New
  • Featured
  • All Posts
  • Tags
  • Search
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • All Posts
  • Data and Analytics
  • Business and Consulting
  • Climate and Energy
  • Cognition and Learning
    • Book Notes
    • Course Notes
    • Other
  • Contemplations and Society
  • IT and Technology
    • How-Tos
    • Scripts
      • Bookmarkletss
      • Userscripts
  • Projects
    • Android
    • Arduino
    • Python
    • Web
  • Cyber Security
    • Challenges
    • Operational Technology (OT)
    • Other
Hero Image
IT Cheatsheet

The scripts and code snippets I copy and paste most often Regex Remove duplicate lines First sort so duplicates are next to each other Option 1 Replace: ^(.*)(\n\1)+$ with $1 Option 2 Replace: ^((^[^\S$]?(?=\S)(?:.)+$)[\S\s]*?)^\2$(?:\n)? with $1 Find lines excluding specific string Option 1 ((?!STRING).)*$ Option 2 ^(?:(?!STRING).)*$ Find Korean/한글 text [가-힣] Javascript Select all text by class/ID etc Also TagName, ID, … a=document.getElementsByClassName('CLASS');b=[];Array.from(a).forEach((e)=>{b.push(e.innerText)});c=b.toString();copy(c);

  • IT
  • Computing
  • Regex
  • JavaScript
  • Scripting
Sunday, July 2, 2023 | 1 minute Read
Contact me:
  • james@gibbins.me
  • jamgib

Home page image source: me