Tuesday, January 7, 2025

Regex: utk WA

Dr. Nugroho - Khusus Pasien: 

  1........

|  Handle bold characters in WA

|  Search text..lazy mode

|  (.)([^/])\(?!\)(.?)\([^/*])

|  Replace with

|  $1$2<b>$3</b>$4


|  2.......

|  Nugroho /kanan:

|  (\d{1,2})\/(\d{1,2})\/(\d{2})..(\d\d\:\d\d).+Nugroho.+\: (.*)

|  Replace with

|  <div class="kanan"><h2>$5<p>$2/$1/$3 - $4</p></h2></div>


|  3…….......................

|  Chat 2 orang: (kiri sesudah Nugroho)

|  (\d{1,2})\/(\d{1,2})\/(\d{2})..(\d\d\:\d\d).+\:(.*)

|  Replace with

|  <div class="kiri"> <h1>$5<p>$2/$1/$3 - $4</p></h1></div>


|  4…….......................

|  Untuk group:  

sesudah Nugroho

|  (\d{1,2})\/(\d{1,2})\/(\d{2})..(\d\d\:\d\d)...(.)\: (.)

|  Replace with

|  <div class="kiri"> <h1><b>$5</b><br>

$6<p>$2/$1/$3 - $4</p></h1></div>


|  5.…….......................

|  Untuk baris yang belum punya <tag>

|  \n(?!\<div)(.*)

|  Replace with

|  \n<br>$1


|  6.…….......................

Pindahkan date ke akhir list.

Dobel bintang jadikan 1


Lazy search: sesudah Br

|  (\<div.)(\<p.)\n(\<br[\s|\S]*?)\n(\<div)

|  Kalau separo jalan: cari <Br>

(\<br.)(\<p.)\n(\<br[\s|\S]*?)\n(\<div)

|  Replace with

|  $1\n$3$2\n$4

|  7.…….......................

Cari tanggal yang beda 👇🏻👇🏻

|  >(\d{1,2}\/\d{1,2}\/\d{2})(.\n)\<div((?:(?!\<div)[\s\S])\<p\>)(?!\1)(\d{1,2})\/(\d{1,2})\/(\d{2})

|  Replace with

|  >$1$2<div class="tengah">$4-$5-20$6</div>\n<div$3$4/$5/$6

|  8.…….......................

Ubah number ke month name.

Append dictionary dulu

|  (\<div.+tengah\"\>.+)

|  Replace with

|  $1 ..1,Jan;2,Feb;3,Mar;4,Apr;5,May;6,Jun;7,Jul;8,Aug;9,Sep ;10,Oct;11,Nov;12,Dec

|  9…….......................

Search number, replace month name

|  (\<div.+tengah\"\>\d{1,2})\-(\d{1,2})\-(.+)(\<\/div\>).+?(?=\2)\d{1,2},(\w+)

|  Replace with

|  $1 $5 $3$4

|  10…….......................

Remove trailing months

|  (\<div.+tengah\"\>.+\<\/div\>).+

|  Replace with

|  $1

|  .....…….......................



HTML header for WA

<!DOCTYPE html>

<html>

<head>

<title>WhatsApp Backup</title>


<style>

@media screen and (max-width: 768px) 

{

.kiri {

     width: 85%;  

    /* font-family:"Helvetica";*/

    font-weight:400;

     font-size: 100%;

   margin-top: 0px;

    margin-bottom: 0px;

 }

.kanan {

      margin-left:15%;

     width: 85%;  

    /* font-family:"Helvetica";*/

    font-weight:400;

    font-size: 100%;

    margin-top: -10px;

    margin-bottom: -10px;

 }

.tengah {

    margin-left:0;

    width: 100%;  

    font-weight: bold;

    font-size: 90%;

    text-align: center;

    margin-top: 10px;

    margin-bottom: 6px;

 }


h1 {

    display: table; 

    width:auto;

    margin-left:12%; 

    margin-right: auto;

    margin-bottom:0;

    /*margin: 0px auto 0px auto; * keep the table centered */

    background-color: lightgreen;

    border: 1px solid #000;

    border-radius: 15px;

   /* font-family:"Helvetica";*/

    font-weight:400;

    font-size: 130%;

padding: 8px;

  margin: 5px;

}

h2 {

    display: table; 

    width:auto;

    margin-left:auto;

    margin-right:3%;

    background-color: lightgrey;

    border: 1px solid #000;

    border-radius: 15px;

   /* font-family:"Helvetica";*/

    font-weight:400;

    font-size: 130%;

    padding: 8px;

}

h4 {

    display: table; 

    width:auto;

    margin-left:auto;

    margin-right:3%;

    font-weight: normal;

    font-size: 80%;

}


p { font-size:70%;

     font-weight: normal;

     text-align:right;

     margin-top:0;

     margin-bottom: -7px;

   }

b { font-size:100%;

    font-weight:bold;

    color:red;

  }

body {

  background-color: #FDFEE0;

  background-repeat: no-repeat;

  background-attachment: fixed;

  background-size: 100% 100%;

  font-family:Helvetica, arial, sans-serif;

    font-weight:400;

    font-size: 100%;

  /** very important to break long link*/

  overflow-wrap: break-word;

  word-wrap: break-word;

  word-break: break-word;

}

}

</style>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

No comments:

Post a Comment