CARI Infonet

 Forgot password?
 Register

ADVERTISEMENT

View: 2480|Reply: 8

Regular Expression.. MARI TOLONG!!!

[Copy link]
Post time 16-2-2012 11:14 AM | Show all posts |Read mode
hi,

aku ade prob keje ni. da tny senior pun die xtau. skrg ni aku de prob ttg regular expression. aku tgk die convert regular expression tu into hexadecimal.. aku xtau camne cara die convert...

ni contoh die...

      // Pre-compiled regular expression '^[0-9a-zA-Z\r\n\~\`\!\@\#\$\^\&\*\(\)\[\]\{\}\:\,\.\?\/\-\\\_\=\'\| ]+$'
      

       private static char[] customAllowedCharacterPatternInstructions =
       {
           0x007c, 0x0000, 0x0058, 0x005e, 0x0000, 0x0003, 0x005b,
           0x0020, 0x0043, 0x0030, 0x0039, 0x0061, 0x007a, 0x0041,
           0x005a, 0x000d, 0x000d, 0x000a, 0x000a, 0x007e, 0x007e,
           0x0060, 0x0060, 0x0021, 0x0021, 0x0040, 0x0040, 0x0023,
           0x0023, 0x0024, 0x0024, 0x005e, 0x005e, 0x0026, 0x0026,
           0x002a, 0x002a, 0x0028, 0x0028, 0x0029, 0x0029, 0x005b,
           0x005b, 0x005d, 0x005d, 0x007b, 0x007b, 0x007d, 0x007d,
           0x003a, 0x003a, 0x002c, 0x002c, 0x002e, 0x002e, 0x003f,
           0x003f, 0x002f, 0x002f, 0x002d, 0x002d, 0x005c, 0x005c,
           0x005f, 0x005f, 0x003d, 0x003d, 0x0027, 0x0027, 0x007c,
           0x007c, 0x0020, 0x0020, 0x007c, 0x0000, 0x0006, 0x0047,
           0x0000, 0xffba, 0x007c, 0x0000, 0x0003, 0x004e, 0x0000,
           0x0003, 0x0024, 0x0000, 0x0003, 0x0045, 0x0000, 0x0000,
       };

bila aku test convert RE to hexadecimal based on RE yg kat atas tu gune unicode table, xjadi pun mcm bentuk ni.

anyone can help how die leh dapat bentuk HEXADECIMAL mcm tu daripada RE yg kat atas tu?
Reply

Use magic Report


ADVERTISEMENT


Post time 16-2-2012 10:00 PM | Show all posts
aku tak paham act apa soalannya ni..

tapi kalau nak create hexadecimal using regex

/^0x[0-9A-F]{1,4}$/i
Reply

Use magic Report

 Author| Post time 16-2-2012 11:06 PM | Show all posts
soalan die, camne nak create hex from regex. da jumpa da cara actually. gune je library from jakarta-apache tu. td ter-blur jap. tq anyway
Reply

Use magic Report

Post time 17-2-2012 06:42 AM | Show all posts
ok
Reply

Use magic Report

 Author| Post time 17-2-2012 11:29 AM | Show all posts
ok
kmkd Post at 17-2-2012 06:42


ade lg. ade sape2 leh tolong x bagi regular expression supaya die boleh accept alphanumeric, _ (underscore). bracket (), dash - and slash / .....

help please....
Reply

Use magic Report

Post time 17-2-2012 12:10 PM | Show all posts
aku nak tolong tp 1st question pun dah kantoi.

btw apa yg aku tau regular expression atau bahasa mudahnya regex bnyk digunakan di dlm irc scripting utk detect perkataan2 yg mencarut dlm cenel.

cth -> //echo -a $regex(this is a test,/this is a (test|balloon|sausage)/)
Reply

Use magic Report

Follow Us
Post time 17-2-2012 12:11 PM | Show all posts
ade lg. ade sape2 leh tolong x bagi regular expression supaya die boleh accept alphanumeric, _ ( ...
underwoodrockz Post at 17-2-2012 11:29


aku rs function regex ko yg post #1 tu leh sapot semua dah tu termasuk underscore n alphanumeric...
Reply

Use magic Report

 Author| Post time 17-2-2012 02:28 PM | Show all posts
ok. da dapat gak. hahahaha
Reply

Use magic Report


ADVERTISEMENT


 Author| Post time 17-2-2012 02:32 PM | Show all posts
aku rs function regex ko yg post #1 tu leh sapot semua dah tu termasuk underscore n alphanumeric ...
otai_g Post at 17-2-2012 12:11



yg no 1 tu, sbb itu adelah pattern utk allowable pny characters pattern. bila ko masuk bnyk2 characters, akan jadi stack overflow. mmg library jakarta-apache tu problem die gitu kot.

so, aku ubah sket function die tu.. instead of checking ape yg allowable, aku check ape characters yg xleh field aku tu terima. so, checking lg sikit n die xgune bnyk sgt memory kot. at this moment mmg jalan elok la compare to yg 1st aku post tu.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CARI Infonet

26-4-2024 05:00 AM GMT+8 , Processed in 0.058851 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list