Guest User

regex example

a guest
Oct 20th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. // The regex:
  2.  
  3. /<status>\s?HP (\d+\/\d+)\s(\d+) Fire Ofuda\s+(\d+) Wind Ofuda\s+(\d+) Barrier Ofuda\s+(\d+) Water Ofuda\s+(\d+) Earth Ofuda\s+(\d+) Binding Ofuda\s+YIN: (\d)\/3\s+YANG: (\d)\/3\s+...\s+(READY|CHARGING)\s?<\/status>/g
  4.  
  5. // An example of the kind of string it's supposed to capture:
  6.  
  7. <status>
  8. HP 40/135 2 Fire Ofuda 3 Wind Ofuda 0 Barrier Ofuda 0 Water Ofuda 2 Earth Ofuda 0 Binding Ofuda YIN: 0/3 YANG: 0/3 必殺技 CHARGING
  9. </status>
  10.  
  11.  
  12. // What the regex turns the string into:
  13.  
  14. <div style="background: linear-gradient(180deg, #6B7B8C 0%, #526474 50%, #3E4E5E 100%); border: 3px solid #606060; border-radius: 8px; padding: 20px; box-shadow: inset 0 0 0 2px #8090D0, inset 0 0 0 4px #6a7194; color: white; position: relative; image-rendering: pixelated; font-family: Consolas, monospace; font-size: 1.3em;">
  15.  
  16. <div style="text-align:center; margin-bottom:10px;">STATUS</div>
  17.  
  18. <div style="display:flex; justify-content:space-between; margin-bottom:6px;">
  19. <span><b>HP: </b>$1</span>
  20. </div>
  21.  
  22. <div style="display:flex; justify-content:space-between; margin-bottom:4px;">
  23. <span><b>$2</b> Fire Ofuda</span>
  24. <span><b>$3</b> Wind Ofuda</span>
  25. <span><b>$4</b> Barrier Ofuda</span>
  26. </div>
  27.  
  28. <div style="display:flex; justify-content:space-between; margin-bottom:4px;">
  29. <span><b style="color:black;">$5</b> Water Ofuda</span>
  30. <span><b style="color:black;">$6</b> Earth Ofuda</span>
  31. <span><b style="color:black;">$7</b> Binding Ofuda</span>
  32. </div>
  33.  
  34. <div style="display:flex; justify-content:space-between; margin-top:6px;">
  35. <span><b style="color:black;">YIN: </b>$8/3 ☯ <b>YANG: </b>$9/3</span>
  36. </div>
  37.  
  38. <div style="margin-top:8px;">必殺技 <b>$10</b></div>
  39. </div>
Advertisement
Add Comment
Please, Sign In to add comment