Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
No Match

r"""
"""
gmxi

Test String

Code Generator

Generated Code

# coding=utf8 # the above tag defines encoding for this document and is for Python 2.x compatibility import re regex = r""" ^\(?.*?(?P<qno>\d{1,2})[\)\.]\s? \s? A\.?\s?(?P<A>.+?) \s+ B\.?\s?(?P<B>.+?) \s+ C\.?\s?(?P<C>.+?) \s+ D\.?\s?(?P<D>.+$) """ test_str = ("1. 第三部分 英语知识运用 (共两节,满分25分)\n" "第一节: 完形填空(共15小题,每小题1分,满分15分)\n" "通读下面短文,掌握其大意,然后在各题所给的四个选项(A、B、C和D)中选出一个最佳选项.\n" "Something that I learnt from both my parents was the importance of having respect(尊重) for other people. I remember one day when we were travelling on a bus and_ 36 sat down while other people were standing. My mother shouted at me “ 37 immediately! You have young legs and you don't need to sit down.” At the time I felt embarrassed about being told off 38 , but now I understand. I think children nowadays have 39 that respect and it really makes me angry if I see children sitting down while 40 people are standing.\n" "One area in which we had a lot of rules was table 41 , For example, we weren't allowed to start our meal 42 the oldest person had started. We had to say \"thank you\" when our food was 43 , and eat everything on our plates before we could 44 the table. We couldn't make any noise when eating. Worse than that, we were only 45 to have sweets at the weekend, as a special 46 if we had been good.\n" "Although my upbringing(养育) was perhaps a bit 47 compared with modern children, I'm very thankful to my parents for giving me a clear 18 in lite. Even though I was sometimes 49 , I think it has made me a better person. In my view, children need clear rules, but more than that they need to 1earn how to get on with 50 people and realize they are not the center of the world.\n" "36. A. they B. you C. I D. she\n" "37. A. Get up B. Sit up C. Give up D. Look up\n" "38. A. in order B. in pubic C. in surprise D. in person\n" "39. A. won B. Shown C. wasted D. lost\n" "40. A. older B. richer C. taller D. heavier\n" "41. A. designs B. manners C. materials D. sizes\n" "42. A. if B. because C. until D. though\n" "43. A. cooked B. eaten C. prepared D. served\n" "44. A. move B. book C. leave D. lay\n" "45. A. allowed B. forced C. warned D. advised\n" "46. A. lesson B. treat C. choice D. need\n" "47. A. simple B. interesting C. normal D. strict\n" "48. A. direction B. answer C. introduction D. plan\n" "49. A. protected B. encouraged C. fooled D. punished\n" "50. A. some B. other C. few D. several\n\n" "答案:CABDA BCDCA BDADB\n" "(2021年浙江省杭州市中考)\n\n" "2. 第三部分英语知识运用 (共两节,满分15分)第一节:完形填空(共1小题,每小题15分,满分15分)通读下面短文,掌握其大意,然后在各题所给的四个选项(A.B、C和D)中选出一个最佳选项.\n" "14.(15分)Eddie was filled with excitement. The mountain bike(1) was about to start and he had been training hard. Perhaps, this year, he would finally(2) . The waiting crowd shouted encouragement, and Eddie's dad was among them, smiling(3) .\n" " The starter's gun(4) and Eddie got away quickly.The road was bumpy(起伏不平)with lots of sudden turns,but Eddie was(5) for these challenges,As he went around a corner, he(6) that his friend Riley was the only rider in front of him.\n" " Putting in more effort, Eddie reached Riley and then suddenly he was(7) . He was going to win!\n" " Eddie could(8) the finish line at the top of the next hill.The crowd began to(9) and Eddie heard his father's voice supporting him.\n" " Moments later, Eddie heard a cry. He looked around to see Riley(10) on the road with his bike on top of him. Any minute now, the other(11) would rush toward him over the hill,\n" " Eddie jumped off his bike and ran to Riley.His friend was unhurt and the boys(12) moved Riley's bike off the road.\n" " The other riders(13) past to the finish line, and Eddie heard a cheer go up for the winner.\n" " Slowly, Eddie(14) his bike to the finish line, Tears of disappointment filled his eyes.\n" " Then,to his surprise,Eddie heard a sound and looked over at the crowd to see them cheering for(15) .And there was his dad, with the proudest smile of all.\n\n" "(1)A. show B. race C. trip D. exercise\n" "(2)A. pay B. stop C. rest D. win\n" "(3)A. proudly B. softly C. politely D. weakly\n" "(4)A. broke up B. showed up C. went off D. fell off\n" "(5)A. ready B. thankful C. famous D. late\n" "(6)A. dreamed B. decided C. expected D. realized\n" "(7)A. side by side B.on the top C. in the lead D. far behind\n" "(8)A. pass B.see C.touch D. draw\n" "(9)A. laugh B. hide C. cheer D. leave\n" "(10)A. standing B. lying C. training D. travelling\n" "(11)A. riders B. parents C. winners D. crowds\n" "(12)A. secretly B. suddenly C. separately D. quickly\n" "(13)A. sped B. walked C. spread D.ran\n" "(14)A. threw B. pushed C. sent D. tied\n" "(15)A. them B. themselves C. him D. himself\n" "答案:BDACA DCBCB ADABC\n" "(2020年浙江省杭州市中考)\n\n\n\n\n\n\n\n\n\n\n" "3.第三部分 英语知识运用(共两节,满分25分)\n" "第一节:完形填空(共15小题,每小题1分,满分15分)\n" "通读下面短文,掌握其大意,然后在各题所给的四个选项(A、B、C和D)中选出一个最佳选项.\n" "Katy Sullivan is an actress, an athlete (运动员), and a person who also refuses to accept the words no or I can’t.\n" "She was born without the lower half of her 36 and has worn prosthetic (假体) ones all her life. She grew up in Alabama, US and had a(n) 37 childhood. She kept up with her sisters and brothers at the gym and the swimming pool. She feels lucky 38 her family treated her in just the same way as the other members.\n" "When a person is born without legs, there are plenty of things that are 39 to do. But Katy believed she could 40 anything. So she chose two jobs that are difficult, 41 with both legs. As a teenager, she once saw a good movie. Before it was 42 , Katy had made her mind up to be a(n) 43 .\n" "She did a degree in theater and then moved to Los Angeles, where she has played 44 in theater, television and movies. She has a positive (积极的) view of life. She thinks that if you believe 45 can do something, you should 46 it. So when Katy’s friend asked her 47 she’d like to try running, she said “yes”. She was given a pair of running legs and she 48 her new life.\n" "Katy was the first person in the world with two prosthetic legs to 49 running as a competitive sport. She entered the final of the 100 meters in the 2012 London Paralympics.\n" "Katy’s family, friends, and fans look up to her as an 50 of someone who has overcome her difficulty and achieved her dreams.\n\n" "36. A. arms B. legs C. feet D. hands\n" "37. A. embarrassing B. lonely C. active D. strange\n" "38. A. though B. unless C. before D. because\n" "39. A. difficult B. important C. possible D. easy\n" "40. A. achieve B. accept C. examine D. prevent\n" "41. A. just B. also C. even D. ever\n" "42. A. up B. over C. on D. out\n" "43. A. athlete B. writer C. actress D. coach\n" "44. A. games B. music C. sports D. roles\n" "45. A. you B. we C. she D. they\n" "46. A. depend on B. go for C. get used to D. look after\n" "47. A. whether B. how C. when D. why\n" "48. A. shared B. started C. changed D. prepared\n" "49. A. fix up B. show up C. take up D. set up\n" "50. A. ancestor B. enemy C. influence D. example\n\n" "答案:BCDAA CBCDA BABCD \n\n" "(2019浙江省杭州市中考)\n\n" "4. 第三部分 英语知识运用(共两节,满分25分)\n" "第一节:完形填空(共15小题,每小题1分,满分15分)\n" "通读下面短文,掌握其大意,然后在各题所给的四个选项(A、B、C和D)中选出一个最佳选项.\n" "My friends and I joined a two-day survival (生存) training course in the mountains. The first day was really 36 ---there was so much to do! Arriving at the campsite, we were divided into groups and given a tent , some food, a 37 and a compass(指南针). Standing next to a small river. Fanny 38 camping in the grassy area nearby. However, our instructor, Mr. Lee, pointed out that it might flood (淹没) if it rained. In the end, we found a 39 area. Putting up the tent was very hard. 40 Mr. Lee helped us a lot.\n" "By the time we had put up the tent, 41 was really hungry. \"We wouldn’t have got this hungry if we had brought some snacks, \"Peter said. We all told him to 42 complaining(抱怨) and help us start a fire to cook our food 43 , Realizing we were having trouble making the fire, he finally 44 .\n" "The next day started early. Woken by a strange noise. Peter went to see what was 45 . \"Some cows have eaten our breakfast!\" he shouted. \"That's all because you didn't 46 he food properly last night.\" said Mr. Lee.\n" "Worried that Mr. Lee was angry with us, we tried very hard on our next 47 ---using the map and compass to find a secret location. We made it to the location 48 the other groups did. We all felt very proud of 49 .\n" "The survival training course was a great 50 . Now I feel I could survive anywhere!\n" "( )36. A. disappointing B. difficult C. different D. boring\n" "( )37. A. map B. book C. light D. knife\n" "( )38. A. suggested B. finished C. imagined D. enjoyed\n" "( )39. A. nearer B. lower C. bigger D. higher \n" "( )40. A. Surprisingly B. Suddenly C. Luckily D. Usually\n" "( )41. A. everyone B. anyone C. someone D. no one\n" "( )42. A. start B. mind C. stop D. continue\n" "( )43. A. yet B. too C. again D. instead\n" "( )44. A. helped out B. gave out C. worked out D. started out\n" "( )45. A. developing B. happening C. beginning D. following\n" "( )46. A. throw off B. put away C. eat up D. sell out\n" "( )47. A. pain B. lesson C. task D. problem\n" "( )48. A till B. after C. when D. before\n" "( )49. A. him B. them C. you D. ourselves\n" "( )50. A. example B. experience C. activity D. competition\n\n" "答案:BAADC ACDAB BCDDB\n\n" "(2018年浙江省杭州市中考)\n\n\n\n\n" "5. 笫三部分英语知识运用(共两节,满分25分)\n" "策一节:完形填空(共15小题.每小题1分.满分15分)\n" "通读下面短文,掌握其大意,然后在各题所给的(A、B,C和D)中选出一个最佳选项.\n" "This story tells of two sporting heroes who made impossible dream come true. Bob Champion was a young jockey(骑师with a bright36. Then, one day, he fell off his horse. He went to the doctor37his injuries(伤) and was surprised when he38that he had cancer. The medical treatment lasted many months and made him very39. At times, he nearly died.\n" "At the same time, there was a successful40called Aldaniti. Unluckily, during one race, the horse got a serious injury. The horsed owners41to put the horse down though the doctor advised the horse’s trainer to do so. They42Aldaniti for a whole year and the horse’s injuries got better.\n" "By this time, Bob Champion was out of43. Slowly, he got back his strength. Eight months later, he44to his job as a jockey. A month after that, he rode the winning horse in a race. Soon afterwards, Aldaniti45returned to training.\n" "Early the next year,46Bob Champion and Aldaniti were almost back to full fitness. Now, there wan a new plan. Bob decided to47Aldaniti in the Grand National, one of the UK’s most famous horses races. People watching the race knew all about the48fights against ill health and injury. Every one of them wanted the fairy tale to have a49ending. And it was perfect. Aldaniti and Bob Champion were real sporting50.\n" "36.A.future B. idea C. smile D. voice\n" "37.A.instead of B. except for C. because of D. away from\n" "38.A.suggested B. discovered C. expected D. remembered\n" "39.A.sad B. scared C. poor D. weak\n" "40.A.doctor B. horse C. owner D. trainer\n" "41.A.refused B. prepared C. regretted D. forgot\n" "42.A.waited for B. looked for C. called in D. paid for\n" "43.A.work B. school C. sight D. hospital\n" "44.A.stuck B. belonged C. returned D. moved\n" "45.A.also B. still C. even D. again\n" "46.A.either B. both C. all D. each\n" "47.A.stop B. walk C. ride D. feed\n" "48.A.one’s B. pair’s C. group’s D. family’s\n" "49.A.sad B. funny C. happy D. similar\n" "50.A.heroes B. players C. results D. events\n\n" "答案:ACBDB ABDCA BCBCA\n" "(2017年浙江省杭州市中考)\n\n\n\n" "6.二、完形填空(本題有15小題,每小題1分,共15分)(共1题;共15分)\n" "阅读下面短文,掌握大意,然后从每小题所给的A、B、C、D四个选项中选出最佳选项. \n\n" "\"Where could Michael be?\" I wondered aloud. \n" "Michael was my classmate. He liked playing pranks on others. \n" "He once put a sign that said \"Sing to Me!\" on 1  back. It was terrible. Everywhere I went, people I didn't even know started singing to me. When I realized what was happening, I got really 2 .\n" "Another time, he embarrassed Nicole during sharing time. Nicole was shy. She 3 shared; she always said, \"Pass.\" But what did Michael do when it was his turn to share? He asked, \"Did everybody 4  how Nicole's new blue dress matches her eyes?\" Nicole's face turned bright red. Poor Nicole!\n" "It was Valentine's Day that day. I was sure Michael was up to something somewhere, 5  he always was. No way was I going to let him pull a prank — ruining someone's Valentine's Day. \n" "I 6  him everywhere. Lunch break was almost over. I must find him and stop him. When I got to the classroom, there was Michael Peterson, at Michael Rogers's desk, digging in his 7  of valentines!\n" "\"Hurry and help me,\" said Michael as soon as he 8  me.   \n" "At first I thought he was stealing valentines from Michael Rogers's box. However, the more I watched, the more puzzled I became. He was putting valentines 9 .\n" "Seeing my expressions, he told me that he found Michael Rogers's box was 10  when he was passing out his valentines. Michael Rogers was new and Mrs. Karcher must have forgotten to put his name on the list, so 11  made him a card. \n" "I suddenly realized I had also 12  to prepare a valentine for Michael Rogers. \n" "\"But everyone made one for me,\" Michael continued* \"So I'm giving him my 13 . since we've got the same name — Michael.\"\n" "I stood there, not quite believing 14  I was hearing. \"Is Michael Peterson the one who always pulled pranks on us?\" I asked myself. Maybe he was kind of 15 … in a hidden sort of way. \n" "1. A. my B. his C. her D. its\n" "2. A. tired B. bored C. angry D. nervous\n" "3. A. often B. never C. always D. sometimes\n" "4. A. mind B. record C. notice D. decide\n" "5. A. or B. but C. unless D. because\n" "6. A. stayed with B. talked about C. shouted at D. looked for\n" "7. A. box B. pocket C. wallet D. school bag\n" "8. A. saw B. met C. found D. caught\n" "9. A. up B. in C. away D. back\n" "10. A. old B. pretty C. empty D. special\n" "11. A. nobody B. anybody C. somebody D. everybody\n" "12. A. refused B. forgotten C. expected D. remembered\n" "13. A. list B. desk C. signs D. cards\n" "14. A. how B. why C. what D. where\n" "15. A. polite B. sweet C. honest D. patient\n\n" "()\n" "答案:ACBCD DAABC ABDCB\n" "(2021年浙江省温州市中考)\n\n\n\n\n\n\n\n\n\n\n\n\n" "7. 二、完型填空\n" "My cousin Roger was big and strong. He was three years older than me and he always wanted to bully 11 .\n" "Near our farm, there was a beautiful 12 , where kids nearby often swam in summer. Over it was a bridge. When we were in the river, Roger always tried to 13 me and hold me under. I would dive down before he could reach me. When I came up to the surface miles away, he was till there, 14 me.\n" "Other kids would shout, \"Hey, he's a fish!\"\n" "Roger said, \"No, he's a shrimp!\"\n" "I replied, \"Better than a 15 whale!\"\n" "One day, we were about to leave after swimming when a truck unexpectedly rushed out of the bridge and fell onto the water. \n" "Eyes wide open, all of us were too 16 to say a word. Then someone cried, \"Oh, no! The driver...\"\n" "Roger shouted to the other kids, \"Go and get 17 .\" Then he turned to me, \"Jack, you're the underwater swimmer! Let's try to pull the 18 out.\" With these words, he jumped into the water. I couldn't 19 that it was Roger, a bully in my eyes. I took a breath and followed him. \n" "The truck lay on one side. We tried to open the door, but 20 . Roger lifted a rock and broke the windscreen. 21 the broken windscreen, I got into the truck and opened the door. \n" "Roger caught hold of the driver. With all his strength, Roger 22 pulled him out and swam towards the surface.\n" "I tried to follow, 23 the water was turning black in front of me. I was falling. I thought I was going to 24 , just at that moment, a strong arm reached down and held me. I tried hard to kick. \n" "Back to the bank, Roger looked at me, \"You OK?\" I managed to nod. \"Not bad for a shrimp.\" he joked. \n" "I was to answer back, but from my mouth came \"Not bad for a 25 whale.\"\n" "It was then that I realized Roger was not \"a fat whale\" at all.\n" "11.A.me B.us C.him D.them\n" "12.A.farm B.river C.bridge D.beach\n" "13.A.call B.save C.teach D.catch\n" "14.A.caring about B.laughing at C.looking for D.worrying about\n" "15.A.fat B.small C.quiet D.serious\n" "16.A.sad B.angry C.excited D.surprised\n" "17.A.help B.advice C.attention D.information\n" "18.A.door B.truck C.driver D.swimmer\n" "19.A.forget B.believe C.explain D.understand\n" "20.A.left B.failed C.passed D.missed\n" "21.A.Inside B.Across C.Behind D.Through\n" "22.A.proudly B.secretly C.confidently D.successfully\n" "23.A.or B.so C.but D.because\n" "24.A.win B.lose C.die D.survive\n" "25.A.brave B.polite C.creative D.humorous\n\n" "答案:ABDCA DACBB DDCCA\n" "(2020年浙江省温州市中考)\n\n\n\n\n\n\n\n\n\n\n\n\n" "8. 二、完形填空(本题有15小题,每小题1分,共15分)\n" "阅读短文,掌握大意,然后从每小题所给的A、B、C、 D四个选项中选出最佳选项.\n" " Ashley was outspoken, fashionable, and the \"Queen Bee\" in my school.\n" " I looked up to her and idolized her. I listened to the music she listened to, wore the clothes she wore. I even took art class though I had really wanted to take theatre. I finally fitted in 11 group.\n" " One day, I skipped out of my last class a few minutes early to\n" "__12 seats for our group at the dining hall. Concentrating on my homework, I didn't notice they had sat down behind me. Before I could say a word, I realized what they were 13 .\n" "I listened silently. \"She's such a loser,\" one girl said.\n" "Another girl added, \"Ashley, she 14 follows you, trying to copy you.\"\n" " \"I wish she would leave us alone. We were in the same summer school and now she thinks we're best friends.\" The once familiar voice sounded so 15 and strange.\n" " I was mortified. My hands were shaking. I couldn't help crying 16 . I felt heart-broken \n" "for the very first time. How did this happen? I 17 we were friends.\n" "I ran home. My mother just held me while I sobbed for hours. The advice she gave was so __18 , and I had heard it a million times. \"Just be yourself and people will like you for 19__ you are. \" This time it became so profound. Then and there I 20 to find myself back. That was exactly-what I did.\n" "Over the next month, I went through a lot of 21 . I bought new clothes that I wanted to wear. I no longer went to art class 22 them, and took theatre. I began making new friends. I developed my own 23 and never again followed the crowd.\n" "I had an amazing school year. 24 I look back, I think it was the year when I discovered the person I was going to be. Despite the pain I felt that day, it was a 25 they had given me.\n" "11. A. my B. her C. his D. our\n" "12. A. get B. buy C. rent D. move\n" "13. A. thinking about B. talking about C. waiting for D. asking for\n" "14. A. once B. always C. hardly D. never\n" "15. A. serious B. special C weak D. cold\n" "16. A. sadly B. shyly C. excitedly D. nervously\n" "17. A. found B. admitted C. realized D. thought\n" "18. A. funny B. simple C. useful D. different\n" "19. A. where B. what C. how D. who\n" "20. A. failed B. forgot C. decided D. continued\n" "21. A. pains B. doubts C. changes D. troubles\n" "22. A. with B. about C. against D. without\n" "23. A skills B. habits C. projects D. opinions\n" "24. A. Before B. Unless C. When D. If\n" "25. A. gift B. choice C. promise D. surprise\n" "答案:BABBD ADBDC CADCA\n" "(2019年浙江省温州市中考)\n" "9. 二、完形填空\n" "It was a Sunday morning. Lori was busy writing in her book. Marilyn was drinking coffee and I was reading a newspaper. Suddenly, Lori looked up and asked,\" Why are there more pictures of Lisa than there are of___11___?\"Lisa is our older daughter.\n" "I stared back, not understanding the___12___. Lori left the room. I looked at Marilyn, \"Are there more pictures of Lisa than of Lori?\"\n" "\"I've never___13___them. I don't know,” replied Marilyn.\n" "\"But___14___would Lori ask such a question? \" I asked. After a few minutes of thought Marilyn said, \"When Lisa was born, you were taking photos. You hardly went___15___without a camera. When Lori was born videos became___16___. You used a video camera to record nearly everything in our life. There must be hundreds of videos of Lori in the computer that Lori has___17___seen or doesn’t remember.\"\n" "Late that night, when we were alone, I turned on the computer and found the___18___about Lori.\n" "“What are you going to do?” Marilyn asked.\n" "\"Her birthday is coming,\" I said, \"Let's make an album for her as a gift. I don't know if the album will answer her question, but at least she'll know that we___19___enough to find her an answer.\"\n" "Over the next few days, we secretly___20___all the videos. We watched and selected until we were ___21___. Marilyn had them made into photos. When the photos were returned, we placed them into an album. When we looked at the album, all the sweet memories came___22___. We hoped it showed how___23___she was to us.\n" "On June 7, when passing Loris room to leave for work. I opened the door and slipped the album inside. Attached to it was a birthday card with a note___24___why her mother and I had put the album together.\n" "It was about eight o'clock when my office telephone rang. I picked up the receiver. A tiny voice spoke, \"I love you, Daddy,\" she said and disconnected. I knew our___25___had been received.\n" "11. A. him B. her C. me D. them\n" "12. A. question B. book C. newspaper D. answer\n" "13. A. seen B. counted C. taken D. bought\n" "14. A. where B. how C. when D. why\n" "15. A. anywhere B. everywhere C. somewhere D. nowhere\n" "16. A. popular B. effective C. expensive D. obvious\n" "17. A. ever B. never C. already D. just\n" "18. A. emails B. pictures C. news D. videos\n" "19. A. respect B. benefit C. care D. regret\n" "20. A. took up B. pointed out C. went through D. handed in\n" "21. A. relaxed B. satisfied C. active D. lucky\n" "22. A. back B. down C. off D. on\n" "23. A. kind B. helpful C. proud D. important\n" "24. A. discussing B. comparing C. explaining D. importing\n" "25. A. message B. prize C. memory D. view\n\n" "答案:CABDA ABDCC BADCA\n" "(2018年浙江省温州市中考)\n\n\n\n\n\n\n\n\n\n" "10. 二、完形填空(本题有15小题,每小题1分,共15分))\n" " 阅读下列短文,掌握大意,然后从每题所给的A、B、C、D四个选项中选出最佳选项.\n" " Johnnie Martin was born in a worker's family. His parents lived a simple life, saving money for the day when they could send him to a good university. They had dreamed that their son could get a good 11 and live a better life. However, to Johnnie, school lessons seemed like a wall that was impossible to go through.\n" " One day when he was in Grade 11, Johnnie went 12 school psychologist’s* office to ask for help.\n" " “Johnnie, I’ve been studying your marks of all the tests at school. I’ve made a 13 study of them,” said the psychologist. \n" "“I’ve been trying hard.\" Johnnie was about to 14 .\n" " The psychologist put his hand on the boy’s shoulder, “People have different kinds of talents, Johnnie. There are painters who were 15 able to learn math, and engineers who can’t sing on key. Some day you will find 16 you are good at, and when you do, you will make your parents and all of us very 17 you.\"\n" " Johnnie didn't go to university. He found a job working in the gardens around the town. Soon 18 amazing happened. His customers began to notice that Johnnie had what they called “green thumb\". The plants he 19 grew, and the roses blossomed*. People started to accept his 20 for gardening, because he had an eye for color and light\n" " One day while he was downtown, he happened to 21 an unused dirty land behind the city hall. He volunteered to make it into a garden. That very afternoon as soon as he got the permission* , he started the work, 22 he couldn’t afford all the tools or the plants that were 23 for it. People gave him young trees. rose—bushes, benches and many other things. Before long, it had become a beautiful little 24 .\n" " Today Johnnie is the head of the business in gardening. Wherever he and his men go, they 25 beauty before the eyes of people.\n" "11. A. job B. garden C. lesson D. present\n" "12. A. into B. past C. along D. through\n" "13. A. funny B. public C. careful D. similar\n" "14. A. lie B. cry C. laugh D. agree\n" "15. A. always B. usually C. sometimes D. never\n" "16. A. how B. when C. what D. where\n" "17. A. strict with B. proud of C. angry with D. sure of\n" "18. A. nothing B. anything C. something D. everything\n" "19. A. picked up B. painted at C. talked about D. looked after\n" "20. A. suggestions B. invitations C. situation D. attention\n" "21. A. buy B. rent C. clean D. notice\n" "22. A. but B. and C. so D. or\n" "23. A. common B. natural C. possible D. necessary\n" "24. A. farm B. lake C. park D. market\n" "25. A. find B. spread C. collect D. describe\n\n" "答案:AACBD CBCDA DADCB\n" "(2017年浙江省温州市中考)\n\n\n\n\n\n\n\n\n\n" "11. 三、完形填空(本大题共 10 小题, 每小题 1 分, 共 10 分)\n" "通读下面短文, 掌握其大意, 然后在每小题所给的四个选项中, 选出一个最佳答案, 并将答 题卡上对应题目所选的选项涂黑.\n" "Many kids are crazy about space. Last month, a space agency (机构) told the public that they were 41 “a planet protection officer. ” Some people laughed at the funny job title, but a 9- year-old boy took the information 42. He wrote a letter to the agency, saying that he wanted the job. \n" "“Dear sirs, my name is Sam Lee. I think I am the 43 person for the job, ” he wrote. \n" "What are Sam's 44 ? For one, he wrote, “My sister says I act like an alien (外星人)” Sam also said he had watched almost all the 45 movies he could find. His last sentence may touch people's hearts:“ I am young, so I can learn to think like an alien. ”\n" "Sam soon got a 46 from Bill Black, director of the agency. “We have received your letter. It is great that you are interested in the job. This job is to 47 the earth from germs ( 细 菌 ) on things brought back from other planets. ” Bill ended the letter with some warm words, 48 Sam to study hard and do well in school. “We hope to 49 you at the agency one day. ” he wrote. \n" "“Among kids, there are 50 space scientists. ” Bill told a newspaper. “We think of this letter as a chance that may forever change our kids life. ”\n" "41. A. waking up B. looking for C. dealing with D. talking about\n" "42. A. simply B. lightly C. seriously D. clearly\n" "43. A. right B. kind C. important D. favorite\n" "44. A. dreams B. problems C. discoveries D. advantages\n" "45. A. war B. road C. space D. sports\n" "46. A. job B. test C. reply D. ticket\n" "47. A. move B. protect C. pull D. collect\n" "48. A. warming B. helping C. ordering D. encouraging\n" "49. A. see B. tell C. thank D. search\n" "50. A. past B. future C. recent D. present\n" "答案:CBDAB BCADC \n" "(2021年广东省中考)\n" "12. 二、完形填空(共1小题: 每小题15分,满分15分)阅读下面短文,掌握其大意,然后从16~25各题所给的A、B、C和D项中选出最佳选项,并在答题卡上将该项涂黑.\n" "2.     One sunny morning,  when Zebra (斑马) visited the river for a cool drink,  he heard a tiny voice.\"Help me,  Zebra!\"\n" "    Zebra looked around and found Wasp(黄蜂)(1)_______in a spider web in a thornbush(荆棘丛).Carefully,  Zebra reached into it,  but the thorns(2)_______ him. \"Ouch!\" Zebra stepped back and was leaving.\n" "    \"Please help me, \" said Wasp.\"One day I will(3)_______ your help.\"\n" "    Zebra laughed.\"I'm fast and strong.Besides, I have a big family.Why would I need help from a(4)_______wasp? \"\n" "    \"Please try one more time, \" Wasp said. Zebra knocked at the web again.(5)_______,  this time it was enough to free Wasp. \"Try to stay out of trouble, \" Zebra said. \"I might not be nearby the next time a spider gets(6)_______.\" Then he left.\n" "    All day,  Zebra stayed with his family until he noticed his favourite fruit﹣﹣ some berries!The hungry Zebra ran to(7)_______ the berries.\n" "    Wasp was resting in the bushes when she saw Zebra. She also found Lion hiding quietly ahead.If Zebra got too close to Lion …\n" "    Thinking quickly,  Wasp flew down and gave Lion a sudden sting. The(8)_______lion cried. \"Roooooaaar!\" Zebra heard the loud cry,  In a second,  he turned around and ran back to his(9)_______.\n" "    A moment later, Wasp flew around Zebra's head.\"Try to stay out of trouble, \"Wasp said with a(10)_______.\"I might not be nearby the next time a lion gets hungry.\"\n\n" "(1)A  resting        B  playing        C  caught        D  hidden\n\n" "(2)A  hurt        B  hit        C  refused        D  killed\n\n" "(3)A  remember        B  return        C  repeat        D  report\n\n" "(4)A  noisy        B  lazy        C  shy        D  little\n\n" "(5)A  Sadly        B  Suddenly        C  Luckily        D  Strangely\n\n" "(6)A  sleepy        B  angry        C  thirsty        D  hungry\n\n" "(7)A  smell        B  taste        C  touch        D  watch\n\n" "(8)A  surprised        B  excited        C  interested        D  bored\n\n" "(9)A  friend        B  family        C  river        D  fruit\n\n" "(10)A  laugh        B  shout        C  wish        D  promise\n\n" "答案:CABDC DBABA\n" " (2020年广东省广州市中考)\n\n" "13. 完形填空(共10小题;每小题15分,满分15分)\n" "阅读下面短文,掌握其大意,然后从16~25各题所给的A、B、C和D项中选出最佳选\n" "项,并在答题卡上将该项涂黑\n" "John suddenly jumped off the swing without even slowing down. He called out nervously,” Mom, where's Charlie? \"He had just 16 he hadn't seen his new puppy for over an hour.\n" "John looked around the garden, behind the bushes, and under the picnic table. No dog! His mother heard 17 in his voice as he called her a second time. \" Mom, I can't find Charlie!\"\n" "She came outside 18. \"Let's look around the garden first. Don,t worry. I'm sure he's close by.\n" "Both son and mother were 19 now, but still no Charlie. Their calls were not completely wasted, though. Joe, the next-door neighbor, and his two daughters Tania and Julie, immediately agreed to help them 20 the lost dog.\n" "But even with five people now searching the town's streets, they had no luck. Charlie was still 21.\n" "Tania suggested they make posters with Charlie’s 22 She had done this when her own cat was lost a year earlier, she told John, and the cat was found the next day.\n" "John agreed. When they got home, he made a poster with a photo of Charlie, Then John heard a 23 and opened his bedroom door. It was Charlie. John was greeted with a big wet kiss Charlie had been_ 24 in the bedroom this whole time, sleeping. John had never been so 25 in his life!\n" "16.A.decided B. forgotten C understood D. realized\n" "17. A anger B. hope C. fear D. warning\n" "18. A actively B. quickly C. carelessly D annoyingly\n" "19. A shouting B. talking C fighting D. thinking\n" "20. A give up B. look for C. run after D. take care of\n" "21. A. missing B asleep C. take D quiet\n" "22. A address B. character C name D. picture\n" "23. A. message B. noise C. voice D. song\n" "24. A shut B. woke C. tied D. saved\n" "25. A afraid B silly C happy D proud\n" "答案:DCBAB ADBAC\n\n" "(2019年广东省广州市中考)\n\n\n" "14. 二、完形填空(共10小题;每小题1.5分,满分15分)\n" "Before graduating college, Jackie began to look for a job. She aimed at a famous company, but the 16 for such jobs was very strong. The company Jackie chose planned to employ only one person, but more than twenty people applied for the job. 17 , Jackie was one of the three people invited for the final interview. The interview was very 18_ . The interviewer asked just a few questions and it was all over in less than 10 minutes. Then the interviewer said to them, \"All of you are very good. Please go home and 19 our response.”\n" "Three days later, Jackie received a message saying she would not be 20 the job. She felt deeply disappointed. That evening. however she received another 21 . This time it said that she got the job.\n" "Jackie later found out that the first message sent to her phone was part of the interview-——a 22 to see if she was suitable for the job. All the three people received the_ 23 _text, but only Jackie's reply 24 the company Of the three, one did not reply. The other said “goodbye” and Jackie said “thank you\". This reply showed that Jackie was a/an 25 person, so the company offered her the job.\n" "16. A. exam B. work C. competition D. plan\n" "17.A. Thankfully B. Unluckily C. Hopefully D. Immediately\n" "18. A. long B. strict C. interesting D. simple\n" "19. A. pick up B. wait for C. deal with D. think of\n" "20. A. offered B. returned C. refused D. shown\n" "21. A. letter B. e-mail C. call D. message\n" "22. A guide B. conversation C. test D. lesson\n" "23. A. same B. other C. second D. whole\n" "24. A. reached B. satisfied C. helped D. surprised\n" "25. A. brave B. clever C. polite D. honest\n" "答案:CADBA DCABC\n" "(2018年广东省广州市中考)\n\n" "15. 二、完形填空(共10小题:每小题1.5分,满分15分)\n" "阅读下面短文,掌握其大意,然后从16?25各题所给的ABCD项中选出最佳选项,并在答题卡上将该项涂黑。\n" "More than 700 years ago, Scotland was fighting with England. The King of England wanted to 16 Scotland(苏格兰). He had a strong army so it was 17 for the Scots to fight. They lost many times. King Robert of Scotland had to run from the English army.\n" "One rainy day, King Robert lay in an old house. He thought that he was not good enough to be king. He was so 18 that he didn't even see a spider(蜘蛛) near him. He19 when he saw the spider climbing. It was trying to climb up to its web at the top of the house but it fell down.\n" "\"How sad!\" thought King Robert. \"The spider is like me. It's not 20 enough.\" He watched while the spider climbed up again. It fell down a second time.\n" "\"Be careful, little spider, or you might die,\" he said. \"Life is so hard. You'll never get back to your web.\" But the spider 21 again and again. King Robert watched while it 22 climbed back to its web. After an hour, the spider got to the web.\n" "\"You're such a great 23,\" he said. \"If you can keep trying, I can too. I must keep on fighting. I won't let the English win.\" His 24 grew strong and they 25 the English army. Scotland was free.\n" "Nobody knows if this is a true story. Many parents tell it to their children because they want them to keep trying.\n" "16. A. leave      B. control         C. help            D. visit\n" "17. A. interesting   B. difficult          C. important          D. necessary\n" "18. A. surprised B. bored           C. worried        D. lonely\n" "19. A. looked ahead B. looked out         C. looked on          D. looked up\n" "20. A. old         B. strong          C. fast            D. free\n" "21. A. tried      B. fell            C. practised      D. cheered\n" "22. A. finally    B. easily          C. slowly          D. suddenly\n" "23. A. player     B. fighter         C. soldier         D. spider\n" "24. A. army        B. feelings        C. opinions        D. family\n" "25. A. kept        B. raised          C. stopped         D. joined\n\n" "答案:BBCDB ACDAC\n\n" "(2017年广东省广州市中考)\n" "16. III. 完形填空。(每小题1. 5 分, 共 15 分)\n" "根据知文内容, 从 A、B、C、D 四个选项中选出一个能填入相应空格内的最佳答案, 并把答题卡上对应题目的答案标号涂黑。\n" "It was December 30th. Anna and Alex were helping Mom make banana cakes. They cut up the 31_put the eggs and sugar in the flour(面粉), poured the milk in and mixed them all up.\n" "When they were almost done, Anna asked, \"Mom, why are we making so many cakes?\" \"I want to take some over to Mrs. Brown _32_ the street, \"said Mom. \"Her husband died of a serious illness a few days ago. She only has her dog Wangwang in the house. \"\n" "Mom put the cakes in the oven(烤箱)and the children helped _33_ the mess. The cakes were finally done. They all waited 34_until the cakes cooled down. Then they put some on a plate and headed to the opposite house. \n" "When Mrs. Brown opened the door, Anna said, \"Mrs. Brown, we have brought you some banana cakes. \"\"Thank you. 35 smell delicious, \"Mrs. Brown said, \"Wangwang and I are feeling a little _36_ these days. It's kind of you to come. \"\n" "\"Would you like to _37_ us tomorrow for New Year's dinner?\" asked Mom. \"Take Wangwang, too. \"\"Well I'm not sure, \"said Mrs. Brown. \"Please say yes, \"said Alex. \"Come to our house, _38_ it will be great fun, \" said Anna. \n" "Anna was _39_. They never had such a pleasant dinner. Mrs. Brown thanked them for inviting Wangwang and her, saying she felt better. 40 was doubled when shared. \n" "31. A. bananas B. apples C. oranges D. strawberries \n" "32. A. beside B. behind C across D. around\n" "33. A. look for B. give away C hand out D. clean up\n" "34. A. strongly B. bravely C. quickly D. patiently\n" "35. A. I B. We C. You D. They \n" "36. A. lonely B. angry C. excited D. relaxed\n" "37. A. invite B. join C. ask D. call\n" "38. A. though B. but C. and D. or\n" "39. A. wrong B. right C. quiet D. strict\n" "40. A. Kindness B. Happiness C. illness D. Sadness\n" "答案:ACDDD ABCBB\n" "(2021年重庆市中考英语A卷)\n\n\n" "17. III. 完形填空。(每小题 1. 5 分, 共 15 分)\n" "根据短文内容, 从A、B、C、D四个选项中选出一个能填入相应空格内的最佳答案并把答题卡上对应题目的答案标号涂黑。\n" "Ma Li is a dessert shop owner in Yinchuan, Ningxia, On a cool morning, she received an online 31 but it took an hour for her to wait for the deliveryman(外卖送餐员). \n" "When the deliveryman came, Ma was a little 32 . \"It is too cold outside and my motorbike didn't work, \"explained the deliveryman. After she heard his words, her anger was 33 . She invited him to sit for a while and offered him a cup of hot water. \n\n" "At that moment, Ma noticed the deliveryman's face and hands were dark purple 34 he was working outside for too long. She felt sorry for him. While they were talking, Ma knew that the deliveryman wanted to buy her daughter a 35 , but he thought it was a little expensive. \n" "After the deliveryman left, Ma _36 what happened just now on her WeChat Moments(微信朋友圈)with two photos of the deliveryman. \n" "Heartwarming comments(评论)poured in, such as Life is not easy but 37 of us give up!\", \"Thumbs up(点赞)for hard-working people \"and\" Showing understanding to deliverymen. \"Some _38_ offered money for a cake. \n" "The next day, Ma got in touch with the deliveryman and invited him to her shop. When they met, Ma expressed people's kindness to him and gave him a cake for his daughter's birthday. The deliveryman was _39 .\n" "Ma received more than 600 yuan in donations(捐献) 40 her friends and customers. She said she would use the money to offer some help to people in need. \n" "31. A. gift B. order C. ticket D. invitation\n" "32. A. excited B. sad C. happy D. angry\n" "33. A. gone B. stopped C. lost D. broken\n" "34. A. because B. so C. when D. though\n" "35. A. schoolbag B. birthday cake C. new coat D. computer\n" "36. A. found B. remembered C. shared D. heard\n" "37. A. all B. each C. most D. none\n" "38. A. even B. never C. hardly D. ever\n" "39. A. helpful B. careful C. thankful D. wonderful\n" "40. A. to B. from C. with D. for\n\n" "答案:BDAAB CDACB\n\n" "(2021年重庆市英语中考B卷)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" "18.完型填空\n" "11.     Our junior high school life is coming to an end. So my classmates and I decided to make a special___1___for our own favorite teacher in the ceramics( 陶艺) class.\n" "    After being dried for a long time in the fire, our gifts for teachers were__2____.Chen Hui took them out of the kiln(窑). CRASH ( 碎裂声) ! His cup, Xiao Yao's___3___, and my heart broke into pieces all over the floor.\n" "    “My elephant lost her trunk (象鼻) !\" Xiao Yao shouted. \"My heart is broken!\" I___4___almost at the same time.\n" "    \"I'm so sorry!\" Chen Hui said.\n" "    \"Bring__5____to the repair station,\" said Xiao Yao, \"Let's see what we can do with some magic ___6___the magic glue worked only on Chen Hui's cup. The trunk and glue. \" We tried many times, the heart were in too many broken bits to put back together.\n" "    \"Now my elephant has a short nose instead of a trunk,\" said Xiao Yao, \"It__7____ like a little dog with big ears. And it's__8____lovely! Let's call it doglephant!\"\n" "    \"A cute doglephant! Cool! You just turned the accident into a happy one!\" I said. And right then, I knew___9___to do. Maybe I could make a mosaic ( 镶嵌画) by using the pieces of my broken heart.\n" "    When it was all done, everyone thought it was pretty cool. Yes, my present didn't turn out the way I'd planned, but it turned out even___10___!\n" " (1)A  gift        B  hat        C  bag        D  coat\n" " (2)A  safe        B  broken        C  ready        D  wet\n" " (3)A  dog        B  elephant        C  cat        D  panda\n" " (4)A  smiled        B  read        C  wrote        D  cried\n" " (5)A  something        B  nothing        C  everything        D  anything\n" " (6)A  as        B  but        C  so        D  though\n" " (7)A  looks        B  sounds        C  smells        D  tastes\n" " (8)A  still        B  even        C  almost        D  hardly\n" " (9)A  when        B  how        C  which        D  what\n" "(10)A  worse        B  better        C  heavier        D  cheaper\n\n" "答案:ACBDC BAADB\n" "(2020年重庆市中考英语A卷)\n\n\n\n\n\n\n\n\n\n" "19. III.完形填空。(每小题1.5分,共15分)\n" "根据短文内容,从A、B、C、D四个选顶中选出一个能填入格内的最佳答案,并把答题卡上对应的题目标号涂黑。\n" " Being street smart is an important skill to have and a good way to take care of yourself.\n" "Always carry your phone with you, but do not look at 31while yon are walking. Be able to communicate or call for help is important, so keep a list of useful numbers. But put your phone away while you are walking so that you can keep your32 up see what’s going on around. If you do need to check your phones, 33and look at it quickly.\n" " Don’t wear earphones34you are out. If you have to35 something when you’re out, use only one earphone or play it at a very low volumn(音量).\n" " Travel with 36orfamily members when possible and never go anywhere with a stranger. It’s 37to be careful with strangers. Remember not to get into a stranger’s car if they call you over.\n" " 38 dark and out-of-the-way places. Do not take a short cuts through dark areas, even if it will make your trip much faster. If you have to go to unsafe places, go 39 someone you know or speak to someone over the phone while you are there.\n" " Run and shout if you feel unsafe. Run away as fast as you can towards a police station, hospital, on nearby business for 40. Shout as loudly as you can to get the attention of people nearby.\n" "31. A. me B. it C. him D. her\n" "32. A. head B. nose C. hands D. arms\n" "33. A. walk B. run C. stop D. start\n" "34. A. though B. unless C. until D. while\n" "35. A. look for B. wait for C. listen to D. talk to\n" "36. A. parents B. brothers C. sisters D. friends\n" "37. A. important B. impossible C. boring D. interesting \n" "38. A. Find B. Avoid C. Visit D. Clean\n" "39. A. to B. for C. with D. without\n" "40. A. help B. drink C. money D. medicine\n\n" "答案:BCBDA DABCB\n" "(2020年重庆市中考英语B卷)\n\n\n\n\n\n\n\n\n\n\n\n" "20. III. 完形填空。(每小题1.5分,共15分)\n" "根据短文内容,从A、B、C、D四个选项中选出一个能填入相应空格内的最佳答案,并把答题卡上对应题目的答案标号涂黑。\n" "Right after lunch, Mother found she had got a cold. She did need a rest in bed. But first she had a few things to do. Prepare the meat for __31__. Leave a note for the cleaners...\n" "At last, she fell into bed, soon asleep...\n" "Then the door banged(砰地一声) open as the __32__ came home from school. “Mom! Mom! Where are you?” “Didn’t you even get up yet?” “What about dinner?”\n" "“I’m sick. And I can’t do anything. I’ll have to leave all to __33__. Cook the potatoes. Take care of the baby. Put plates, spoons and forks on the table.”\n" "“Wonderful! \" \" No problem! \" The children ran off __34__. Mother was left in her quiet room. She felt terrible! But everyone else seemed great. In fact, there seemed to b a party going on with loud laughs __35__ the children.\n" "There was a sudden crash(破碎声). Then a voice shouted, \"Get the baby out of the way —__36__ he cuts himself. Don' break Mom's rest!”\n" "Another crash came! The younger girl rushed in with news. \"They __37__ your plate and the dog ate all your dinner.”\n" "The girl ran off. There was more noise until, finally, the children appear, __38__. They were proud of what they brought. There is a glass of water, three beans, a cold boiled potato and a small piece of burned meat. \n" "Suddenly, Mother felt __39__. As the children watched carefully, she ate her cold dinner. “Everything __40__ so good,” Mom smiled. “Thank you, my kids. I feel better now.”\n" "31. A. tea B. breakfast C. lunch D. dinner \n" "32. A. father B. cleaners C. children D. dog\n" "33. A. you B. me C. her D. him\n" "34. A. excitedly B. sadly C. quietly D. angrily\n" "35. A in B. with C. from D. under\n" "36. A. after B. before C. when D. until\n" "37. A made B dropped C. sold D. changed\n" "38. A. crying B. smiling C. cooking D. sleeping\n" "39. A tired B. afraid C. weak D. great\n" "40. A tastes B. looks C. smells D. sounds\n\n" "答案:DCAAC BBBDA\n\n" "(2019年重庆市英语中考A卷)\n") matches = re.finditer(regex, test_str, re.MULTILINE | re.VERBOSE | re.IGNORECASE) for matchNum, match in enumerate(matches, start=1): print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group())) for groupNum in range(0, len(match.groups())): groupNum = groupNum + 1 print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum))) # Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html