---
# System prepended metadata

title: "\U0001F3C5 5/13(五) 每日 JS 刷題任務 - 正規表達式(週末讀物)"
tags: [公益程式體驗營 - 2022]

---

---
tags: 公益程式體驗營 - 2022
---

# 🏅 5/13(五) 每日 JS 刷題任務 - 正規表達式(週末讀物)

## 體驗營學員補充教學
* [十五分鐘認識正規表達式，解決所有文字難題](https://5xruby.tw/posts/15min-regular-expression)
* [初探Regex 正規表達式](https://moojing.medium.com/javascript-%E5%88%9D%E6%8E%A2regex-%E6%AD%A3%E8%A6%8F%E8%A1%A8%E9%81%94%E5%BC%8F-1da2f4d94795)
* [MDN：正規表達式](https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Guide/Regular_Expressions)
* [八道题带你看懂正则表达式！](https://juejin.cn/post/7022823286258008071)
* [深入淺出正則表達式](https://youtu.be/Ex6cCWDwNJU)


### 題目一：手機號碼是否正確
* 是否為 10 碼
* 是不是 09 開頭
``` =JavaScript
// input 輸入
checkPhoneNumber("0955717222")
checkPhoneNumber("331")
checkPhoneNumber("09839398")
checkPhoneNumber("0977121333")
// output 輸出
true
false
false
true
```
### 題目二：訂單編號
超瞎書局的訂單編號規則
* 只有 6 碼
* 開頭必須是 B 開頭
``` =JavaScript
// input 輸入
checkFiveWord("B12")
checkFiveWord("B89212")
checkFiveWord("B8987987")
checkFiveWord("B33212")
checkFiveWord("A33212")
// output 輸出
false
true
false
true
false
```

### 題目三：驗證密碼
來兒美超商的電商密碼規則如下：

1. 至少一個大寫英文
2. 至少一個小寫英文
3. 至少一個數字
4. 至少 8 碼以上

[Google 關鍵字提供](https://www.google.com/search?rlz=1C5CHFA_enTW989TW989&sxsrf=ALiCzsZbd2sNO7QIbGCV88z-zop4MoiDxw:1651826809850&q=%E6%AD%A3%E5%89%87%E8%A1%A8%E9%81%94%E5%BC%8F+%E5%AF%86%E7%A2%BC&sa=X&ved=2ahUKEwiF6eyxvsr3AhVQDN4KHVBSBncQ7xYoAHoECAEQOA&cshid=1651826859140280&biw=1198&bih=755&dpr=1.25)

``` =JavaScript
// input 輸入 
checkPassword("Abc87654")
checkPassword("Av3")
checkPassword("YYYYCC123")
checkPassword("BBBa930033")
checkPassword("Ka78328K")
// output 輸出
true
false
false
true
true

```




## 回報流程

1. 將答案貼在 Codepen 並複製 Codepen 連結貼至「回報區」回報
（也可以將答案直接貼至「回報區」）

![](https://i.imgur.com/vftL5i0.png)

<!-- 解答：  -->


回報區
---

<!-- 0. Bingbingboom（回報範例，請使用註解回報）
答案：（可直接撰寫答案）
Codepen：https://codepen.io/Bingbingboom/pen/jOBZVWq
-->

<!-- 1. Bruno Yu
Codepen：https://codepen.io/bruno-yu/pen/yLveyKY?editors=1111
-->

<!-- 2. Wendy
答案：（可直接撰寫答案）
Codepen：https://codepen.io/wendy03/pen/rNJxjOQ
-->

<!-- 3. pipi
答案：
Codepen：https://codepen.io/pipiyy13/pen/ExQjjPO
-->

<!-- 4. su#7798
codepen: https://codepen.io/wc-su/pen/XWZjPeG
-->

<!-- 5. Alphacostankion#8475
Codepen:
https://codepen.io/alphapolo/pen/zYRKmmN
-->

<!-- 5. yunyun#5215
Codepen:
https://codepen.io/yun_yunni/pen/XWZjxLM
-->


<!-- 6. CloThEs
答案：
Codepen：https://codepen.io/bogwdnxx-the-sans/pen/dydpQOg
-->

<!-- 7. 白狐
Codepen：https://codepen.io/baihu7851/pen/wvyzQgB
-->

<!-- 8. Jason Chen
Codepen：https://codepen.io/jason60810/pen/JjpRejM
-->

<!-- 9. yuyu#6310
Codepen：https://codepen.io/yuyu0905/pen/vYdXQqY?editors=0012
-->

<!-- 10. Chi
Codepen: https://codepen.io/YoChi84/pen/GRQjPdW 
-->

<!-- 11.Irene
 codepen:https://codepen.io/ntjtcxpt-the-animator/pen/bGLwQaE?editors=1012
-->

<!-- 12.Aaron
Codepen : https://codepen.io/narrowd4c/pen/GRQJoJP
-->

<!-- 13. Yuhung#1391
codepen: https://codepen.io/Yu__hung/pen/WNMGPoL?editors=0012
-->

<!-- 14. Stanley#3825
codepen: https://codepen.io/sean_1215/pen/JjpRxvN
-->

<!-- 15. Knn#0492
codepen: https://codepen.io/Knn_84/pen/oNEzVwa?editors=0010
-->


<!-- 16. EllieLo#9809
codepen: https://codepen.io/ellie-lo/pen/VwQKqGj?editors=0011
-->

<!-- 17. Peng
https://codepen.io/peng-027/pen/YzeGdzz
 -->

<!-- 18. Art regex 是個酷東西😎
https://codepen.io/ss97202tw/pen/PoQGgWb?editors=0011
 -->
 
<!-- 19. Joyce#3790
  https://codepen.io/joycehuang/pen/VwQKOWz?editors=0111
-->

<!-- 20. hsiuhsiu
  https://codepen.io/hsiuhsiu/pen/vYdXwxW?editors=0011
-->

<!-- 21. Tuhacrt#0008
Codepen: https://codepen.io/Tuhacrt/pen/oNEzRjY?editors=1011
-->

<!-- 22. SASIMI #5099
Codepen:
https://codepen.io/sashimi1327/pen/JjpRQxe
-->

<!-- 23. lyle#8123
Codepen:
https://codepen.io/tomys/pen/RwQGXvp?editors=0010
-->

<!-- 24. Xiang#5313
Codepen:
https://codepen.io/snorlaxxu/pen/OJQbLzo?editors=0110
-->

<!-- 25. Charlotte Lee
Codepen:
https://codepen.io/charlotte-lee/pen/GRQNJbw?editors=0012
-->

<!-- 26. andersonshen#4675
Codepen:
https://codepen.io/luxyenni-the-bold/pen/qBxazPy
-->

<!-- 27.  Pearlie#3536
Codepen: https://codepen.io/PPcode/pen/ExQNmNj
-->

<!-- 28.  Raymond Lam#0344
Codepen: https://codepen.io/manshun-lam/pen/JjpbNwN
-->

<!-- 28.  Josh Chen#4552
Codepen: https://codepen.io/hiphop825/pen/rNJWYop?editors=0010
-->

<!-- 29.  安安你好你是誰#7416
Codepen: https://codepen.io/leave3310-the-looper/pen/ZErBrKg
-->

<!-- 30.  Katie
Codepen: https://codepen.io/Katie24/pen/oNEYEWB
-->

<!-- 31.  Vera#5592
Codepen: https://codepen.io/skvera/pen/mdXrBoQ
-->

<!-- 31. bonnieli1414#4906
Codepen: https://codepen.io/bonnieli1414/pen/oNEYyWY?editors=0010
-->

<!-- 32. Wilson#8687
Codepen: https://codepen.io/foolwilson/pen/gOvLyZg
-->

<!--  33. WangNextDoor
Codepen: 
https://codepen.io/stevetanus/pen/BaYQErW
-->

<!--  34. Chaco
Codepen: 
 https://codepen.io/chaco-wang/pen/NWybQrb?editors=0011
-->

<!-- 35. hw#0715
Codepen: https://codepen.io/Lhwei/pen/mdXONjP 
-->

<!-- 36. Jia-Hong Chen#3863
Codepen: https://codepen.io/iloveleon19/pen/GRQjzEd?editors=0010
-->

<!-- 楓之聲#6945
Codepen: https://codepen.io/sshane258/pen/yLvgJja 
-->

<!-- 38. RayChen#6088
Codepen: https://codepen.io/raychen1996/pen/ZErLXod
-->

<!-- 39. 小鹿Kerwin#5730
Codepen: https://codepen.io/tkoleo84119/pen/XWZpRvX?editors=0012
-->

<!-- 40. Easton#3863
Codepen: https://codepen.io/EastonIsCodingNow/pen/WNMRXrB
-->


<!-- 41. han#9437
Codepen: https://codepen.io/qnrxylcw-the-reactor/pen/NWypKRX
-->

<!-- 42. Mojito#6002
 codepen: https://codepen.io/vu3xk41997/pen/VwQpXvW
-->

<!-- 43. Chaoci#2460
 codepen:https://codepen.io/gmailchao/pen/MWQpZvm?editors=0010
-->

<!-- 44. ChaoChao
https://codepen.io/EmiiilyJ/pen/PoQmLJR
-->

<!-- 45.Vito#7797
https://codepen.io/Vito_Yang/pen/ExQXyva?editors=0010
-->

<!-- 46.Mitour#0672
 codepen: https://codepen.io/mitour/pen/YzexGqE -->
 
<!-- 47.bakiii
  https://codepen.io/aki168/pen/MWQvQrv -->
  
<!-- 48. WeiKai#1867
Codepen: https://codepen.io/beginneraboutlife116/pen/gOvjdoq
-->

<!-- 49. 小金#3256
codepen: https://codepen.io/AmoGH357/pen/xxYageZ
-->