{"id":1484,"date":"2025-09-27T22:33:57","date_gmt":"2025-09-27T15:33:57","guid":{"rendered":"https:\/\/kienthucmo.com\/?p=1484"},"modified":"2025-11-05T23:34:08","modified_gmt":"2025-11-05T16:34:08","slug":"huong-dan-kiem-tra-noi-dung-chuoi-trong-python-tu-co-ban-den-nang-cao","status":"publish","type":"post","link":"https:\/\/kienthucmo.com\/vi\/huong-dan-kiem-tra-noi-dung-chuoi-trong-python-tu-co-ban-den-nang-cao\/","title":{"rendered":"H\u01b0\u1edbng d\u1eabn ki\u1ec3m tra n\u1ed9i dung chu\u1ed7i trong Python: T\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao"},"content":{"rendered":"\n<p>Khi l\u00e0m vi\u1ec7c v\u1edbi ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh Python, m\u1ed9t trong nh\u1eefng ki\u1ec3u d\u1eef li\u1ec7u m\u00ecnh s\u1eed d\u1ee5ng th\u01b0\u1eddng xuy\u00ean nh\u1ea5t ch\u00ednh l\u00e0 <strong>chu\u1ed7i (string)<\/strong>. Chu\u1ed7i xu\u1ea5t hi\u1ec7n trong h\u1ea7u h\u1ebft m\u1ecdi ch\u01b0\u01a1ng tr\u00ecnh: t\u1eeb d\u1eef li\u1ec7u ng\u01b0\u1eddi d\u00f9ng nh\u1eadp v\u00e0o, file log, \u0111\u1ebfn n\u1ed9i dung web. Ch\u00ednh v\u00ec v\u1eady, vi\u1ec7c bi\u1ebft c\u00e1ch <strong>ki\u1ec3m tra n\u1ed9i dung chu\u1ed7i<\/strong> tr\u1edf th\u00e0nh k\u1ef9 n\u0103ng c\u01a1 b\u1ea3n nh\u01b0ng v\u00f4 c\u00f9ng quan tr\u1ecdng.<\/p>\n\n\n\n<p>Trong th\u1ef1c t\u1ebf, ki\u1ec3m tra n\u1ed9i dung chu\u1ed7i gi\u00fap m\u00ecnh gi\u1ea3i quy\u1ebft nhi\u1ec1u v\u1ea5n \u0111\u1ec1: x\u00e1c th\u1ef1c email, ph\u00e2n t\u00edch v\u0103n b\u1ea3n, t\u00ecm ki\u1ebfm t\u1eeb kh\u00f3a, x\u1eed l\u00fd d\u1eef li\u1ec7u \u0111\u1ea7u v\u00e0o, ho\u1eb7c \u0111\u01a1n gi\u1ea3n l\u00e0 ki\u1ec3m tra chu\u1ed7i c\u00f3 r\u1ed7ng hay kh\u00f4ng. N\u1ebfu kh\u00f4ng n\u1eafm v\u1eefng c\u00e1c k\u1ef9 thu\u1eadt n\u00e0y, ch\u01b0\u01a1ng tr\u00ecnh c\u00f3 th\u1ec3 g\u1eb7p l\u1ed7i ho\u1eb7c x\u1eed l\u00fd sai d\u1eef li\u1ec7u.<\/p>\n\n\n\n<p>Trong b\u00e0i vi\u1ebft n\u00e0y, m\u00ecnh s\u1ebd h\u1ec7 th\u1ed1ng l\u1ea1i to\u00e0n b\u1ed9 ki\u1ebfn th\u1ee9c c\u1ea7n thi\u1ebft \u0111\u1ec3 ki\u1ec3m tra chu\u1ed7i trong Python: t\u1eeb c\u00e1c to\u00e1n t\u1eed c\u01a1 b\u1ea3n, ph\u01b0\u01a1ng th\u1ee9c built-in, \u0111\u1ebfn bi\u1ec3u th\u1ee9c ch\u00ednh quy (regex) v\u00e0 c\u00e1c t\u00ecnh hu\u1ed1ng n\u00e2ng cao. B\u1eaft \u0111\u1ea7u th\u00f4i n\u00e0o<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. S\u1eed d\u1ee5ng c\u00e1c to\u00e1n t\u1eed c\u01a1 b\u1ea3n \u0111\u1ec3 ki\u1ec3m tra chu\u1ed7i<\/h2>\n\n\n\n<p>Python h\u1ed7 tr\u1ee3 c\u00e1c to\u00e1n t\u1eed gi\u00fap ki\u1ec3m tra nhanh n\u1ed9i dung chu\u1ed7i m\u00e0 kh\u00f4ng c\u1ea7n vi\u1ebft code ph\u1ee9c t\u1ea1p.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.1. To\u00e1n t\u1eed <code>in<\/code> v\u00e0 <code>not in<\/code><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 c\u00e1ch \u0111\u01a1n gi\u1ea3n nh\u1ea5t \u0111\u1ec3 ki\u1ec3m tra m\u1ed9t chu\u1ed7i con c\u00f3 t\u1ed3n t\u1ea1i trong chu\u1ed7i kh\u00e1c hay kh\u00f4ng.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>text = \"Python is powerful and simple\"\n# Check if substring exists\nprint(\"Python\" in text)   # True\nprint(\"Java\" in text)     # False\n\n# Check if substring does not exist\nprint(\"C++\" not in text)  # True<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">text <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Python is powerful and simple<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Check if substring exists<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Python<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> text<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Java<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> text<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">     <\/span><span style=\"color: #616E88\"># False<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Check if substring does not exist<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">C++<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">not<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> text<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">1.2. To\u00e1n t\u1eed so s\u00e1nh <code>==<\/code> v\u00e0 <code>!=<\/code><\/h3>\n\n\n\n<p>N\u1ebfu mu\u1ed1n so s\u00e1nh hai chu\u1ed7i c\u00f3 gi\u1ed1ng nhau ho\u00e0n to\u00e0n hay kh\u00f4ng, m\u00ecnh d\u00f9ng<strong> <code><mark style=\"background-color:#7bdcb5\" class=\"has-inline-color\">==<\/mark><\/code><\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>a = \"hello\"\nb = \"hello\"\nc = \"Hello\"\n\nprint(a == b)  # True\nprint(a == c)  # False\nprint(a != c)  # True\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">a <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">hello<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">b <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">hello<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">c <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Hello<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">a <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> b<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">a <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> c<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># False<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">a <\/span><span style=\"color: #81A1C1\">!=<\/span><span style=\"color: #D8DEE9FF\"> c<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u0110\u00e2y l\u00e0 c\u00e1ch nhanh nh\u1ea5t \u0111\u1ec3 ki\u1ec3m tra chu\u1ed7i c\u00f3 kh\u1edbp ch\u00ednh x\u00e1c kh\u00f4ng. Tuy nhi\u00ean, n\u00f3 ph\u00e2n bi\u1ec7t ch\u1eef hoa v\u00e0 ch\u1eef th\u01b0\u1eddng, n\u00ean trong nhi\u1ec1u tr\u01b0\u1eddng h\u1ee3p m\u00ecnh c\u1ea7n chuy\u1ec3n \u0111\u1ed5i chu\u1ed7i v\u1ec1 c\u00f9ng \u0111\u1ecbnh d\u1ea1ng b\u1eb1ng <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\"><strong>.lower()<\/strong><\/mark><\/code> ho\u1eb7c <code><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\"><strong>.upper()<\/strong><\/mark><\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. C\u00e1c ph\u01b0\u01a1ng th\u1ee9c c\u00f3 s\u1eb5n c\u1ee7a chu\u1ed7i trong Python<\/h2>\n\n\n\n<p>Python cung c\u1ea5p nhi\u1ec1u ph\u01b0\u01a1ng th\u1ee9c (methods) r\u1ea5t h\u1eefu \u00edch \u0111\u1ec3 ki\u1ec3m tra chu\u1ed7i.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.1. Ki\u1ec3m tra b\u1eaft \u0111\u1ea7u v\u00e0 k\u1ebft th\u00fac chu\u1ed7i<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code><strong>startswith(prefix)<\/strong><\/code><\/li>\n\n\n\n<li><code><strong>endswith(suffix)<\/strong><\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>\u1ee8ng d\u1ee5ng<\/strong>: ki\u1ec3m tra \u0111\u1ecbnh d\u1ea1ng file, URL, email\u2026<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>filename = \"report.pdf\"\nprint(filename.endswith(\".pdf\"))  # True\n\nurl = \"https:\/\/example.com\"\nprint(url.startswith(\"https\"))    # True\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">filename <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">report.pdf<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">filename<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">endswith<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">.pdf<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">url <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">https:\/\/example.com<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">url<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">startswith<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">https<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">2.2. Ki\u1ec3m tra ch\u1eef c\u00e1i, ch\u1eef s\u1ed1 v\u00e0 k\u00fd t\u1ef1<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code><strong>isalpha()<\/strong><\/code> \u2192 ch\u1ec9 g\u1ed3m ch\u1eef c\u00e1i<\/li>\n\n\n\n<li><code><strong>isdigit()<\/strong><\/code> \u2192 ch\u1ec9 g\u1ed3m ch\u1eef s\u1ed1<\/li>\n\n\n\n<li><strong><code>isalnum()<\/code> <\/strong>\u2192 g\u1ed3m c\u1ea3 ch\u1eef v\u00e0 s\u1ed1<\/li>\n\n\n\n<li><code><strong>isspace()<\/strong><\/code> \u2192 ch\u1ec9 g\u1ed3m kho\u1ea3ng tr\u1eafng<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>data = \"12345\"\nprint(data.isdigit())  # True\n\nword = \"Python\"\nprint(word.isalpha())  # True\n\nmix = \"Python3\"\nprint(mix.isalnum())   # True\n\nspace = \"   \"\nprint(space.isspace()) # True\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">data <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">12345<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">data<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isdigit<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">word <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Python<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">word<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isalpha<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">mix <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Python3<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">mix<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isalnum<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">space <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">   <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">space<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isspace<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Nh\u1eefng ph\u01b0\u01a1ng th\u1ee9c n\u00e0y c\u1ef1c k\u1ef3 h\u1eefu \u00edch khi m\u00ecnh mu\u1ed1n x\u00e1c th\u1ef1c d\u1eef li\u1ec7u ng\u01b0\u1eddi d\u00f9ng.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.3. Ki\u1ec3m tra \u0111\u1ecbnh d\u1ea1ng ch\u1eef<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code><strong>islower()<\/strong><\/code> \u2192 to\u00e0n ch\u1eef th\u01b0\u1eddng<\/li>\n\n\n\n<li><code><strong>isupper()<\/strong><\/code> \u2192 to\u00e0n ch\u1eef hoa<\/li>\n\n\n\n<li><code><strong>istitle()<\/strong><\/code> \u2192 ch\u1eef c\u00e1i \u0111\u1ea7u vi\u1ebft hoa<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>msg1 = \"hello world\"\nmsg2 = \"HELLO\"\nmsg3 = \"Hello World\"\n\nprint(msg1.islower())  # True\nprint(msg2.isupper())  # True\nprint(msg3.istitle())  # True<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">msg1 <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">hello world<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">msg2 <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">HELLO<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">msg3 <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">Hello World<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">msg1<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">islower<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">msg2<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isupper<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">msg3<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">istitle<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">3. Ki\u1ec3m tra chu\u1ed7i v\u1edbi bi\u1ec3u th\u1ee9c ch\u00ednh quy (Regular Expressions)<\/h2>\n\n\n\n<p>Trong nhi\u1ec1u tr\u01b0\u1eddng h\u1ee3p ph\u1ee9c t\u1ea1p, c\u00e1c ph\u01b0\u01a1ng th\u1ee9c c\u00f3 s\u1eb5n kh\u00f4ng \u0111\u1ee7. L\u00fac n\u00e0y m\u00ecnh d\u00f9ng <strong>bi\u1ec3u th\u1ee9c ch\u00ednh quy (regex)<\/strong> v\u1edbi th\u01b0 vi\u1ec7n <code>re<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.1. H\u00e0m th\u01b0\u1eddng d\u00f9ng<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>re.match(pattern, string)<\/code> <\/strong>\u2192 ki\u1ec3m tra t\u1eeb \u0111\u1ea7u chu\u1ed7i<\/li>\n\n\n\n<li><strong><code>re.search(pattern, string)<\/code> <\/strong>\u2192 t\u00ecm trong to\u00e0n b\u1ed9 chu\u1ed7i<\/li>\n\n\n\n<li><code>r<strong>e.findall(pattern, string)<\/strong><\/code> \u2192 tr\u1ea3 v\u1ec1 danh s\u00e1ch t\u1ea5t c\u1ea3 k\u1ebft qu\u1ea3<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3.2. V\u00ed d\u1ee5: ki\u1ec3m tra email<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import re\n\ndef is_valid_email(email):\n    pattern = r\"^&#91;\\w\\.-&#93;+@&#91;\\w\\.-&#93;+\\.\\w+$\"\n    return bool(re.match(pattern, email))\n\nprint(is_valid_email(\"test@example.com\"))  # True\nprint(is_valid_email(\"abc@123\"))           # False\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> re<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">is_valid_email<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">email<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    pattern <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">r<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #EBCB8B\">^<\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #EBCB8B\">\\w\\.-<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #EBCB8B\">@<\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #EBCB8B\">\\w\\.-<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #EBCB8B\">\\.\\w<\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #EBCB8B\">$<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">bool<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">re<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">match<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">pattern<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> email<\/span><span style=\"color: #ECEFF4\">))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">is_valid_email<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">test@example.com<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">is_valid_email<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">abc@123<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">           <\/span><span style=\"color: #616E88\"># False<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">3.3. V\u00ed d\u1ee5: ki\u1ec3m tra s\u1ed1 \u0111i\u1ec7n tho\u1ea1i<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>def is_valid_phone(phone):\n    pattern = r\"^\\d{10}$\"\n    return bool(re.match(pattern, phone))\n\nprint(is_valid_phone(\"0987654321\"))  # True\nprint(is_valid_phone(\"12345\"))       # False\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">is_valid_phone<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">phone<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    pattern <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">r<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #EBCB8B\">^\\d<\/span><span style=\"color: #81A1C1\">{10}<\/span><span style=\"color: #EBCB8B\">$<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">bool<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">re<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">match<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">pattern<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> phone<\/span><span style=\"color: #ECEFF4\">))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">is_valid_phone<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">0987654321<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">is_valid_phone<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">12345<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">       <\/span><span style=\"color: #616E88\"># False<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Regex m\u1ea1nh m\u1ebd nh\u01b0ng c\u00f3 th\u1ec3 kh\u00f3 \u0111\u1ecdc, v\u00e0 t\u1ed1n t\u00e0i nguy\u00ean n\u1ebfu \u00e1p d\u1ee5ng cho d\u1eef li\u1ec7u l\u1edbn. M\u00ecnh th\u01b0\u1eddng \u01b0u ti\u00ean ph\u01b0\u01a1ng th\u1ee9c built-in tr\u01b0\u1edbc, ch\u1ec9 d\u00f9ng regex khi c\u1ea7n.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. C\u00e1c t\u00ecnh hu\u1ed1ng n\u00e2ng cao khi ki\u1ec3m tra n\u1ed9i dung chu\u1ed7i<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">4.1. Ki\u1ec3m tra chu\u1ed7i r\u1ed7ng ho\u1eb7c ch\u1ec9 c\u00f3 kho\u1ea3ng tr\u1eafng<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>msg = \"   \"\nprint(msg.strip() == \"\")  # True\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">msg <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">   <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">msg<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">strip<\/span><span style=\"color: #ECEFF4\">()<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>D\u00f9ng <code><strong>.strip()<\/strong><\/code> \u0111\u1ec3 lo\u1ea1i b\u1ecf kho\u1ea3ng tr\u1eafng tr\u01b0\u1edbc khi so s\u00e1nh.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4.2. Ki\u1ec3m tra chu\u1ed7i con xu\u1ea5t hi\u1ec7n bao nhi\u00eau l\u1ea7n<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>text = \"python is easy, python is powerful\"\nprint(text.count(\"python\"))  # 2\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">text <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">python is easy, python is powerful<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">text<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">count<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">python<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># 2<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">4.3. Ki\u1ec3m tra chu\u1ed7i c\u00f3 ch\u1ee9a k\u00fd t\u1ef1 \u0111\u1eb7c bi\u1ec7t<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import string\n\ndef has_special_characters(s):\n    return any(ch in string.punctuation for ch in s)\n\nprint(has_special_characters(\"hello!\"))  # True\nprint(has_special_characters(\"hello\"))   # False\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> string<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">has_special_characters<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">any<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">ch <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> string<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9FF\">punctuation <\/span><span style=\"color: #81A1C1\">for<\/span><span style=\"color: #D8DEE9FF\"> ch <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> s<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">has_special_characters<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">hello!<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">has_special_characters<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">hello<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #616E88\"># False<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Ho\u1eb7c d\u00f9ng <strong>regex<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import re\nprint(bool(re.search(r\"&#91;^\\w\\s&#93;\", \"hello!\")))  # True<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> re<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">bool<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">re<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">search<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">r<\/span><span style=\"color: #ECEFF4\">&quot;&#91;<\/span><span style=\"color: #81A1C1\">^<\/span><span style=\"color: #EBCB8B\">\\w\\s<\/span><span style=\"color: #ECEFF4\">&#93;&quot;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">hello!<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)))<\/span><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #616E88\"># True<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">5. Th\u1ef1c h\u00e0nh: X\u00e2y d\u1ef1ng c\u00e1c h\u00e0m ti\u1ec7n \u00edch ki\u1ec3m tra chu\u1ed7i<\/h2>\n\n\n\n<p>\u0110\u1ec3 \u00e1p d\u1ee5ng v\u00e0o d\u1ef1 \u00e1n th\u1ef1c t\u1ebf, m\u00ecnh th\u01b0\u1eddng vi\u1ebft s\u1eb5n c\u00e1c h\u00e0m ti\u1ec7n \u00edch.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import re\nimport string\n\n# Check if email is valid\ndef is_valid_email(email):\n    pattern = r\"^&#91;\\w\\.-&#93;+@&#91;\\w\\.-&#93;+\\.\\w+$\"\n    return bool(re.match(pattern, email))\n\n# Check if string contains only numbers\ndef contains_only_numbers(s):\n    return s.isdigit()\n\n# Check if string has special characters\ndef has_special_characters(s):\n    return any(ch in string.punctuation for ch in s)\n\n# Demo\nprint(is_valid_email(\"abc@example.com\"))   # True\nprint(contains_only_numbers(\"12345\"))      # True\nprint(has_special_characters(\"hello@\"))    # True\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> re<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> string<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Check if email is valid<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">is_valid_email<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">email<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    pattern <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">r<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #EBCB8B\">^<\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #EBCB8B\">\\w\\.-<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #EBCB8B\">@<\/span><span style=\"color: #ECEFF4\">&#91;<\/span><span style=\"color: #EBCB8B\">\\w\\.-<\/span><span style=\"color: #ECEFF4\">&#93;<\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #EBCB8B\">\\.\\w<\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #EBCB8B\">$<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">bool<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">re<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">match<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">pattern<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> email<\/span><span style=\"color: #ECEFF4\">))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Check if string contains only numbers<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">contains_only_numbers<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> s<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">isdigit<\/span><span style=\"color: #ECEFF4\">()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Check if string has special characters<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">def<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">has_special_characters<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #ECEFF4\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">any<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">ch <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> string<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9FF\">punctuation <\/span><span style=\"color: #81A1C1\">for<\/span><span style=\"color: #D8DEE9FF\"> ch <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> s<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Demo<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">is_valid_email<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">abc@example.com<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">contains_only_numbers<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">12345<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">has_special_characters<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">hello@<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #616E88\"># True<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>C\u00e1c h\u00e0m n\u00e0y d\u1ec5 t\u00e1i s\u1eed d\u1ee5ng trong nhi\u1ec1u project, \u0111\u1eb7c bi\u1ec7t l\u00e0 khi l\u00e0m web ho\u1eb7c \u1ee9ng d\u1ee5ng x\u1eed l\u00fd d\u1eef li\u1ec7u ng\u01b0\u1eddi d\u00f9ng.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. C\u00e1c l\u01b0u \u00fd v\u00e0 best practices khi ki\u1ec3m tra n\u1ed9i dung chu\u1ed7i<\/h2>\n\n\n\n<p>Qua kinh nghi\u1ec7m, m\u00ecnh r\u00fat ra v\u00e0i \u0111i\u1ec3m quan tr\u1ecdng:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u01afu ti\u00ean ph\u01b0\u01a1ng th\u1ee9c built-in<\/strong> (<code>isalpha<\/code>, <code>startswith<\/code>, \u2026) v\u00ec ch\u00fang nhanh v\u00e0 d\u1ec5 hi\u1ec3u.<\/li>\n\n\n\n<li>Khi so s\u00e1nh chu\u1ed7i, n\u00ean x\u1eed l\u00fd ch\u1eef hoa\/th\u01b0\u1eddng tr\u01b0\u1edbc b\u1eb1ng <code>.lower()<\/code> ho\u1eb7c <code>.upper()<\/code>.<\/li>\n\n\n\n<li>Lu\u00f4n lo\u1ea1i b\u1ecf kho\u1ea3ng tr\u1eafng d\u01b0 th\u1eeba b\u1eb1ng <code>.strip()<\/code>.<\/li>\n\n\n\n<li>V\u1edbi d\u1eef li\u1ec7u ph\u1ee9c t\u1ea1p (email, s\u1ed1 \u0111i\u1ec7n tho\u1ea1i), regex l\u00e0 l\u1ef1a ch\u1ecdn t\u1ed1t nh\u01b0ng c\u1ea7n vi\u1ebft r\u00f5 r\u00e0ng v\u00e0 test k\u1ef9.<\/li>\n\n\n\n<li>N\u00ean vi\u1ebft <strong>unit test<\/strong> cho c\u00e1c h\u00e0m ki\u1ec3m tra chu\u1ed7i \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o kh\u00f4ng x\u1ea3y ra bug.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">7. K\u1ebft lu\u1eadn<\/h2>\n\n\n\n<p>Trong Python, vi\u1ec7c ki\u1ec3m tra n\u1ed9i dung chu\u1ed7i l\u00e0 m\u1ed9t k\u1ef9 n\u0103ng thi\u1ebft y\u1ebfu v\u00e0 c\u00f3 r\u1ea5t nhi\u1ec1u c\u00e1ch \u0111\u1ec3 ch\u00fang ta \u00e1p d\u1ee5ng t\u00f9y t\u00ecnh hu\u1ed1ng. V\u1edbi nh\u1eefng nhu c\u1ea7u \u0111\u01a1n gi\u1ea3n, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng c\u00e1c <strong>to\u00e1n t\u1eed c\u01a1 b\u1ea3n<\/strong> nh\u01b0 <code>in<\/code> hay <code>==<\/code> \u0111\u1ec3 so s\u00e1nh tr\u1ef1c ti\u1ebfp ho\u1eb7c ki\u1ec3m tra s\u1ef1 t\u1ed3n t\u1ea1i. Khi c\u1ea7n chi ti\u1ebft h\u01a1n, c\u00e1c <strong>ph\u01b0\u01a1ng th\u1ee9c built-in<\/strong> nh\u01b0 <code>isalpha()<\/code>, <code>startswith()<\/code>, <code>count()<\/code>\u2026 s\u1ebd h\u1ed7 tr\u1ee3 b\u1ea1n linh ho\u1ea1t trong nhi\u1ec1u tr\u01b0\u1eddng h\u1ee3p. \u0110\u1ed1i v\u1edbi nh\u1eefng y\u00eau c\u1ea7u ph\u1ee9c t\u1ea1p h\u01a1n, ch\u1eb3ng h\u1ea1n nh\u01b0 ki\u1ec3m tra \u0111\u1ecbnh d\u1ea1ng d\u1eef li\u1ec7u, t\u00ecm m\u1eabu v\u0103n b\u1ea3n, th\u00ec <strong>bi\u1ec3u th\u1ee9c ch\u00ednh quy (Regex)<\/strong> ch\u00ednh l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd v\u00e0 kh\u00f4ng th\u1ec3 thi\u1ebfu.<\/p>\n\n\n\n<p>Ngo\u00e0i ra, ch\u00fang ta c\u0169ng kh\u00f4ng n\u00ean b\u1ecf qua nh\u1eefng t\u00ecnh hu\u1ed1ng \u0111\u1eb7c bi\u1ec7t nh\u01b0 chu\u1ed7i r\u1ed7ng, chu\u1ed7i ch\u1ee9a k\u00fd t\u1ef1 \u0111\u1eb7c bi\u1ec7t, hay vi\u1ec7c gi\u1edbi h\u1ea1n s\u1ed1 l\u1ea7n xu\u1ea5t hi\u1ec7n \u2014 \u0111\u00e2y l\u00e0 nh\u1eefng y\u1ebfu t\u1ed1 d\u1ec5 g\u00e2y l\u1ed7i n\u1ebfu kh\u00f4ng x\u1eed l\u00fd c\u1ea9n th\u1eadn.<\/p>\n\n\n\n<p>Khi n\u1eafm v\u1eefng to\u00e0n b\u1ed9 c\u00e1c k\u1ef9 thu\u1eadt n\u00e0y, m\u00ecnh v\u00e0 b\u1ea1n s\u1ebd ti\u1ebft ki\u1ec7m \u0111\u01b0\u1ee3c r\u1ea5t nhi\u1ec1u th\u1eddi gian trong vi\u1ec7c x\u1eed l\u00fd d\u1eef li\u1ec7u th\u1ef1c t\u1ebf, \u0111\u1ed3ng th\u1eddi vi\u1ebft ra nh\u1eefng \u0111o\u1ea1n code g\u1ecdn g\u00e0ng, ch\u00ednh x\u00e1c v\u00e0 \u0111\u00e1ng tin c\u1eady h\u01a1n. \u0110\u00e2y c\u0169ng ch\u00ednh l\u00e0 n\u1ec1n t\u1ea3ng quan tr\u1ecdng \u0111\u1ec3 ti\u1ebfn t\u1edbi c\u00e1c k\u1ef9 thu\u1eadt x\u1eed l\u00fd chu\u1ed7i n\u00e2ng cao h\u01a1n trong Python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8. T\u00e0i li\u1ec7u tham kh\u1ea3o<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Python Software Foundation. <em>Text Sequence Type \u2014 str<\/em>. Python 3 Documentation. <a>https:\/\/docs.python.org\/3\/library\/stdtypes.html#text-sequence-type-str<\/a><\/li>\n\n\n\n<li>Python Software Foundation. <em>re \u2014 Regular expression operations<\/em>. Python 3 Documentation. <a>https:\/\/docs.python.org\/3\/library\/re.html<\/a><\/li>\n\n\n\n<li>Lutz, M. (2013). <em>Learning Python, 5th Edition<\/em>. O\u2019Reilly Media.<\/li>\n\n\n\n<li>Python for Professionals: Learning Python as a Second Language: <a href=\"https:\/\/click.linksynergy.com\/link?id=*C\/UgjGtUZ8&amp;offerid=1562891.3721710002222624882405978&amp;type=15&amp;murl=https%3A%2F%2Fwww.kobo.com%2Fus%2Fen%2Febook%2Fpython-for-professionals-3\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kobo.com\/us\/en\/ebook\/python-for-professionals-3<\/a><\/li>\n\n\n\n<li>Python: Deeper Insights into Machine Learning: <a href=\"https:\/\/click.linksynergy.com\/link?id=*C\/UgjGtUZ8&amp;offerid=1562891.3721710015810095319857183&amp;type=15&amp;murl=https%3A%2F%2Fwww.kobo.com%2Fus%2Fen%2Febook%2Fpython-deeper-insights-into-machine-learning\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kobo.com\/us\/en\/ebook\/python-deeper-insights-into-machine-learning<\/a><\/li>\n\n\n\n<li>DataFusion Python Bindings in Practice: The Complete Guide for Developers and Engineers: <a href=\"https:\/\/click.linksynergy.com\/link?id=*C\/UgjGtUZ8&amp;offerid=1562891.3721710049093362364820452&amp;type=15&amp;murl=https%3A%2F%2Fwww.kobo.com%2Fus%2Fen%2Febook%2Fdatafusion-python-bindings-in-practice\" target=\"_blank\" rel=\"noopener\">https:\/\/www.kobo.com\/us\/en\/ebook\/datafusion-python-bindings-in-practice<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Khi l\u00e0m vi\u1ec7c v\u1edbi ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh Python, m\u1ed9t trong nh\u1eefng ki\u1ec3u d\u1eef li\u1ec7u m\u00ecnh s\u1eed d\u1ee5ng th\u01b0\u1eddng xuy\u00ean nh\u1ea5t ch\u00ednh l\u00e0 chu\u1ed7i (string). Chu\u1ed7i xu\u1ea5t hi\u1ec7n trong h\u1ea7u h\u1ebft m\u1ecdi ch\u01b0\u01a1ng tr\u00ecnh: t\u1eeb d\u1eef li\u1ec7u ng\u01b0\u1eddi d\u00f9ng nh\u1eadp v\u00e0o, file log, \u0111\u1ebfn n\u1ed9i dung web. Ch\u00ednh v\u00ec v\u1eady, vi\u1ec7c bi\u1ebft c\u00e1ch ki\u1ec3m tra n\u1ed9i dung chu\u1ed7i tr\u1edf th\u00e0nh k\u1ef9 n\u0103ng c\u01a1 b\u1ea3n nh\u01b0ng v\u00f4 c\u00f9ng quan tr\u1ecdng.<\/p>\n","protected":false},"author":1,"featured_media":1649,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"googlesitekit_rrm_CAowieHDDA:productID":"","footnotes":""},"categories":[41],"tags":[40],"class_list":["post-1484","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kien-thuc-lap-trinh","tag-python-co-ban"],"_links":{"self":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts\/1484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/comments?post=1484"}],"version-history":[{"count":3,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts\/1484\/revisions"}],"predecessor-version":[{"id":2437,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/posts\/1484\/revisions\/2437"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/media\/1649"}],"wp:attachment":[{"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/media?parent=1484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/categories?post=1484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kienthucmo.com\/vi\/wp-json\/wp\/v2\/tags?post=1484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}