| ¹®ÀÚ | ¿ëµµ | ¿¹Á¦ |
|---|---|---|
| \ |
|
|
| ^ | ¹®ÀÚ¿ÀÇ ½ÃÀÛ. []¾È¿¡¼´Â notÀÇ ÀÇ¹Ì * ^A´Â "A·Î ½ÃÀÛ"À̶ó±â º¸´Ù´Â "½ÃÀÛ Á÷ÈÄ¿¡ A°¡ ³ª¿Â´Ù"´Â ÀÇ¹Ì·Î ÇØ¼®ÇÏ´Â °ÍÀÌ ÁÁ´Ù. Áï, ½ÃÀÛ°ú ³¡°ú °°Àº ºó °ø°£À» ÇϳªÀÇ ¹®ÀÚ·Î °£ÁÖÇÏ´Â °ÍÀÌ ÁÁ´Ù. |
|
| $ | ¹®ÀÚ¿ÀÇ ¸¶Áö¸· |
|
| * | 0¹ø ÀÌ»ó ¹Ýº¹ | |
| + | 1¹ø ÀÌ»ó ¹Ýº¹ ( = {1,} ) | |
| ? | 0¹ø À̳ª 1¹ø | |
| . | new line À» Á¦¿ÜÇÑ ¸ðµç ±ÛÀÚ | |
| (x) | x¸¦ üũÇϰí üũÇÑ °ªÀ» º¯¼ö·Î ÀúÀå | |
| (?:x) | x¸¦ üũÇϰí üũÇÑ °ªÀ» º¯¼ö·Î ÀúÀåÇÏÁö ¾ÊÀ½ | |
| x|y | x ¶Ç´Â y | |
| x(?=y) | xÈÄ¿¡ y°¡ ³ª¿À°í, xºÎºÐ¸¸ ¸ÅĪµÇ´Â ºÎºÐÀ¸·Î °£ÁÖ | |
| x(?!y) | x°¡ ³ª¿À°í ±× µÚ¿¡ y°¡ ÀÖÀ¸¸é ¾È µÊ | |
| {n} | ¾Õ¿¡ ÁöÁ¤ÇÑ °ÍÀÌ n°³ | |
| {n,} | ¾Õ¿¡ ÁöÁ¤ÇÑ °ÍÀÌ n°³ ÀÌ»ó | |
| {n,m} | ¾Õ¿¡ ÁöÁ¤ÇÑ °ÍÀÌ n~m°³ | |
| [xyz] | x³ª y³ª z. []¾È¿¡´Â ¾ó¸¶µçÁö ¾µ ¼ö ÀÖ´Ù. | |
| [x-z] | x¿¡¼ z±îÁö | |
| [^xyz] | x,y,z¸¦ Á¦¿ÜÇÑ ³ª¸ÓÁö ¸ðµç °Í | |
| [\b] | ¹é½ºÆäÀ̽º. \b¿Í È¥µ¿ÇÏÁö ¸»°Í. | ÀϹÝÀûÀÎ String¿¡¼´Â \b°¡ ¹é½ºÆäÀ̽º¸¦ ÀǹÌÇÑ´Ù. |
| \b | ´Ü¾îÀÇ °æ°è.[\b]¿Í È¥µ¿ÇÏÁö ¸»°Í. | |
| \B | \b ¸¦ Á¦¿ÜÇÑ ÀüºÎ | |
| \cX | ÄÁÆ®·ÑX¿Í ¸ÅĪ. \cMÀº ÄÁÆ®·ÑM°ú ¸ÅĪ | |
| \d | ¼ýÀÚ.[0-9]¿Í °°À½ | |
| \D | \d ¸¦ Á¦¿ÜÇÑ ÀüºÎ | |
| \f | form-feed | |
| \n | new line | |
| \r | carriage return | |
| \s | white space ex>ÅÇ, ¶ç¾î¾²±â, \n, \r |
|
| \S | \s ¸¦ Á¦¿ÜÇÑ ÀüºÎ | |
| \t | ÅÇ | |
| \v | vertical tab | |
| \w | ¾ËÆÄºª+¼ýÀÚ+_. [A-Za-z0-9_]¿Í µ¿ÀÏ | _°¡ <b>¸¦ ¸Ô¿©µµ º°·Î Ƽ°¡ ¾È ³´Ù. |
| \W | \w »©°í ÀüºÎ | |
| \n | \nÀÌ ÀÚ¿¬¼öÀ϶§, ()·Î ÁöÁ¤ÇÑ n¹øÂ° Á¤±Ô½Ä | (th)°¡ \1·Î ÁöÁ¤µÈ´Ù. |
| \xhh | hh´Â hexacode, | Code table º¸±â |
| \uhhhh | hhhh´Â hexacode, | ÄÚµå ¹øÈ£> 3131:¤¡ 3163:¤Ó ac00:°¡ d7a3:ÆR (javascript, java) |
| ÇÔ¼ö | Äڵ忹Á¦ | Äڵ弳¸í |
|---|---|---|
| Array RegExp.exec (to be checked) |
|
|
| boolean RegExp.test(to be checked) |
");
|
½ÇÇà°á°ú: |
| String RegExp.toString() |
|
½ÇÇà °á°ú: |
| String String.replace(pattern or string, to be replaced) |
|
½ÇÇà °á°ú:
e°¡ 2¹ø ÀÖÁö¸¸, ù¹øÂ° ÀÎÀÚ°¡ Á¤±Ô½ÄÀÌ ¾Æ´Ï¶ó ¹®ÀÚ¿ÀÏ °æ¿ì´Â ù¹øÂ° °Í¸¸ ¹Ù²Û´Ù. |
|
|
½ÇÇà °á°ú: | |
|
|
½ÇÇà °á°ú:
re¿¡ ÀÇÇØ¼ ã¾ÆÁø ¹®ÀÚ¿ µéÀº re¿¡¼ ()·Î Ç¥ÇöµÈ ¼ø¼´ë·Î $1, $2¿Í °°ÀÌ º¯¼ö·Î ÀúÀåµÈ´Ù. |
|
|
"); document.write(newstr); |
str: ãÀº ¹®ÀÚ¿ p1: ()¿¡¼ °Ë»öµÈ 1¹øÂ° ¹®ÀÚ¿. ¸¶Âù°¡Áö·Î p2,p3 µîµµ °¡´É offset: strÀ» ãÀº À§Ä¡ s : ¿øº» ¹®ÀÚ¿. |
|
| Array String.match(regular expression |
"); } document.write("ºñ±³ "); var str = "ABCdEFgHiJKL"; var myResult = /[a-z]/g.exec(str); for(var cnt = 0 ; cnt < myResult.length; cnt++){ document.write(cnt +":" + myResult[cnt] +" "); } |
½ÇÇà °á°ú: String.match(RegExp) =>g flag°¡ À־ ´Ù ã¾Æ³½´Ù. RegExp.exec(String) =>g flag°¡ ÀÖÀ¸¸é, ÇÑ °³¸¸ ã°í ³¡³½´Ù. |
| Array String.split([separator[, limit]]) |
"); } |
½ÇÇà °á°ú: ÁÖ¾îÁø ¹®ÀÚ¿À» separator¸¦ ±âÁØÀ¸·Î limit ¸¸Å ÀÚ¸¥´Ù. |
String removeTags(input)HTML tagºÎºÐÀ» ¾ø¾ÖÁØ´Ù |
|
|
|
example> "); document.write(removeTags(str)); |
String String.trim()¹®ÀÚ¿ÀÇ ¾ÕµÚ °ø¹éÀ» ¾ø¾ÖÁØ´Ù. |
|
|
|
example> "); document.write("========" + str.trim() + "=============="); |
String String.capitalize()´Ü¾îÀÇ Ã¹ ±ÛÀÚ¸¦ ´ë¹®ÀÚ·Î ¹Ù²ãÁØ´Ù. |
|
|
|
example> |
String number_format(input)ÀÔ·ÂµÈ ¼ýÀÚ¸¦ ,¸¦ ÂïÀº ÇüÅ·Πµ¹·ÁÁØ´Ù |
|
|
|
example> "); document.write(number_format("-9876543.21987")+ " "); document.write(number_format("-123456789.12")+ " "); |
Pattern p = Pattern.compile("(a*)(b)");
Matcher m = p.matcher("aaaaab");
if (m.matches()) {
for (int i = 0; i < m.groupCount() + 1; i++) {
System.out.println(i + ":" + m.group(i));
}
} else {
System.out.println("not match!");
}
result>
0:aaaaab
1:aaaaa
2:b
0¹øÂ°´Â ¸ÅĪµÈ ºÎºÐ.
|
String a = "I love her";
System.out.println(a.replaceAll("([A-Z])", "\"$1\""));
result>
"I" love her
ÀÚ¹Ùµµ $1À» ¾µ ¼ö ÀÖ´Ù.
|
Pattern p = Pattern.compile("cat");
Matcher m = p.matcher("one cat two cats in the yard");
StringBuffer sb = new StringBuffer();
while (m.find()) {
m.appendReplacement(sb, "dog");
System.out.println(sb.toString());
}
m.appendTail(sb);
System.out.println(sb.toString());
result>
one dog
one dog two dog
one dog two dogs in the yard
|