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

/
/
gm

Test String

Code Generator

Generated Code

// include the latest version of the regex crate in your Cargo.toml extern crate regex; use regex::Regex; fn main() { let regex = Regex::new(r"(?m)(?<=<div)(\s*.*\s*)(?=<\/div>)").unwrap(); let string = "keep <head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><link href=\"collinsEC.css\" rel=\"stylesheet\" type=\"text/css\" /></head><body><a name=\"page_top\"></a><div class=\"C1_word_header\"><span class=\"C1_word_header_word\">keep</span><span class=\"C1_word_header_star\">★★★★★</span><span class=\"C1_color_bar\"><ul><li class=\"C1_cabr_1\"></li><li class=\"C1_cabr_2\"></li><li class=\"C1_cabr_3\"></li><li class=\"C1_cabr_4\"></li><li class=\"C1_cabr_5\"></li><li class=\"C1_cabr_6\"></li></ul></span></div><div class=\"tab_content\" id=\"dict_tab_101\" style=\"display:block\"><div class=\"part_main\"><div class=\"collins_content\"><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">1</a></span><span class=\"C1_explanation_label\">[V-LINK-ERG] 连系动词[及物/不及物]</span><span class=\"C1_text_blue\">使保持;</span>If someone <span class=\"C1_inline_word\">keeps</span> or <span class=\"C1_inline_word\">is kept</span> in a particular state, they remain in it. <span class=\"C1_word_gram\">[V n adj/prep] [V adj/prep]</span></div><ul><li><p class=\"C1_sentence_en\">The noise kept him awake...</p><p>噪音吵得他一直没有睡着。</p></li><li><p class=\"C1_sentence_en\">Reggie was being kept busy behind the bar...</p><p>雷吉一直在柜台后忙活。</p></li><li><p class=\"C1_sentence_en\">To <span class=\"C1_text_blue\">keep</span> warm they burnt wood in a rusty oil barrel...</p><p>他们在一只生锈的油桶里烧木柴来保暖。</p></li><li class=\"sentence_1\"><p class=\"C1_sentence_en\">For several years I kept in touch with her.</p><p>几年来,我一直和她保持联系。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">2</a></span><span class=\"C1_explanation_label\">[V-ERG 及物/不及物动词] </span><span class=\"C1_text_blue\">使处于;使留在;</span>If you <span class=\"C1_inline_word\">keep</span> or you <span class=\"C1_inline_word\">are kept</span> in a particular position or place, you remain in it. <span class=\"C1_word_gram\">[V adv/prep] [V n with adv] [V n prep]</span></div><ul><li><p class=\"C1_sentence_en\">Keep away from the doors while the train is moving...</p><p>列车运行过程中要远离车门。</p></li><li><p class=\"C1_sentence_en\">He kept his head down, hiding his features...</p><p>他低头掩面。</p></li><li><p class=\"C1_sentence_en\">It was against all orders to smoke, but a cigarette kept away mosquitoes...</p><p>吸烟违反所有规章,但香烟可以驱蚊。</p></li><li class=\"sentence_2\"><p class=\"C1_sentence_en\">Doctors will <span class=\"C1_text_blue\">keep</span> her in hospital for at least another week.</p><p>医生会让她再住至少一个星期的院。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">3</a></span><span class=\"C1_explanation_label\">[V-ERG 及物/不及物动词] </span><span class=\"C1_text_blue\">使坚持避免或不卷入;</span>If you <span class=\"C1_inline_word\">keep off</span> something or <span class=\"C1_inline_word\">keep away from</span> it, you avoid it. If you <span class=\"C1_inline_word\">keep out of</span> something, you avoid getting involved in it. You can also say that you <span class=\"C1_inline_word\">keep</span> someone <span class=\"C1_inline_word\">off</span> ,<span class=\"C1_inline_word\">away from</span> or <span class=\"C1_inline_word\">out of</span> something. <span class=\"C1_word_gram\">[V prep/adv] [V n prep/adv]</span></div><ul><li><p class=\"C1_sentence_en\">I managed to stick to the diet and <span class=\"C1_text_blue\">keep</span> off sweet foods...</p><p>我努力做到了只吃规定饮食,不沾甜食。</p></li><li><p class=\"C1_sentence_en\">He's going to be a fantastic player if he <span class=\"C1_text_blue\">keep</span>s away from booze and women...</p><p>如果能不近酒色,他将成为一名出色的运动员。</p></li><li><p class=\"C1_sentence_en\">The best way to <span class=\"C1_text_blue\">keep</span> babies off sugar is to go back to the natural diet and eat lots of fresh fruit.</p><p>避免婴儿摄入食糖的最好办法是让其回归自然的饮食,多吃新鲜水果。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">4</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">阻止或防止、阻碍…做;</span>If someone or something <span class=\"C1_inline_word\">keeps</span> you <span class=\"C1_inline_word\">from</span> a particular action, they prevent you from doing it. <span class=\"C1_word_gram\">[V n from -ing]</span></div><ul><li><p class=\"C1_sentence_en\">Embarrassment has kept me from doing all sorts of things...</p><p>我总是害怕受窘,什么事都不敢去做。</p></li><li><p class=\"C1_sentence_en\">He kept her from being lonely...</p><p>他不让她感到孤独。</p></li><li><p class=\"C1_sentence_en\">What can you do to <span class=\"C1_text_blue\">keep</span> it from happening again?</p><p>你怎样防止它再次发生?</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">5</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">忍住或克制不做;</span>If you try to <span class=\"C1_inline_word\">keep from</span> doing something, you try to stop yourself from doing it. <span class=\"C1_word_gram\">[V from -ing]</span></div><ul><li><p class=\"C1_sentence_en\">She bit her lip to <span class=\"C1_text_blue\">keep</span> from crying...</p><p>她咬住嘴唇不哭。</p></li><li><p class=\"C1_sentence_en\">He had to lean on Dan to <span class=\"C1_text_blue\">keep</span> from falling.</p><p>他不得不靠在丹身上以免摔倒。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">6</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">保守;隐瞒;</span>If you <span class=\"C1_inline_word\">keep</span> something <span class=\"C1_inline_word\">from</span> someone, you do not tell them about it. <span class=\"C1_word_gram\">[V n from n]</span></div><ul><li><p class=\"C1_sentence_en\">She knew that Gabriel was <span class=\"C1_text_blue\">keep</span>ing something from her.</p><p>她知道加布里埃尔有事瞒着她。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">7</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">重复;继续;</span>If you <span class=\"C1_inline_word\">keep</span> doing something, you do it repeatedly or continue to do it. <span class=\"C1_word_gram\">[V -ing] [V P -ing]</span></div><ul><li><p class=\"C1_sentence_en\">I <span class=\"C1_text_blue\">keep</span> forgetting it's December...</p><p>我总是忘了现在是12月了。</p></li><li><p class=\"C1_sentence_en\">I turned back after a while, but he kept walking...</p><p>我过了一会就往回走了,但他还接着走。</p></li><li class=\"C1_en_tip\"><span class=\"C1_inline_word\">Keep on</span> means the same as <span class=\"C1_inline_word\">keep</span> .<span class=\"C1_text_blue\">keep on 同keep</span><ul class=\"C1_vli\"><li><p class=\"C1_sentence_en\">Did he give up or <span class=\"C1_text_blue\">keep</span> on trying?...</p><p>他是放弃了还是在继续努力?</p></li><li><p class=\"C1_sentence_en\">My wife <span class=\"C1_text_blue\">keep</span>s on saying that I work too hard.</p><p>我妻子总说我工作太辛苦了。</p></li></ul></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">8</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">与某些名词连用,表示持续一段时间或继续做某事持续,继续持有或控制;</span><span class=\"C1_inline_word\">Keep</span> is used with some nouns to indicate that someone does something for a period of time or continues to do it. For example, if you <span class=\"C1_inline_word\">keep a grip on</span> something, you continue to hold or control it. <span class=\"C1_word_gram\">[V n]</span></div><ul><li><p class=\"C1_sentence_en\">Until last year, the regime kept a tight grip on the country...</p><p>直到去年,那个国家还处于该政权的严密控制之下。</p></li><li><p class=\"C1_sentence_en\">One of them would <span class=\"C1_text_blue\">keep</span> a look-out on the road behind to warn us of approaching vehicles...</p><p>他们中会有一人看着后面的路,提醒我们注意过来的车辆。</p></li><li><p class=\"C1_sentence_en\">His parents kept a vigil by his bedside as he was given brain and body scans.</p><p>在他做脑扫描和全身扫描时,他的父母守护在他床边。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">9</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">保留;保有;留有;</span>If you <span class=\"C1_inline_word\">keep</span> something, you continue to have it in your possession and do not throw it away, give it away, or sell it. <span class=\"C1_word_gram\">[V n]</span></div><ul><li><p class=\"C1_sentence_en\">'I like this dress,' she said. 'Keep it. You can have it,' said Daphne...</p><p>“我喜欢这件连衣裙,”她说。“留下吧。给你了,”达夫妮说道。</p></li><li><p class=\"C1_sentence_en\">Lathan had to choose between marrying her and <span class=\"C1_text_blue\">keep</span>ing his job.</p><p>莱森不得不在娶她和保住工作之间作出选择。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">10</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">存放;储存;</span>If you <span class=\"C1_inline_word\">keep</span> something in a particular place, you always have it or store it in that place so that you can use it whenever you need it. <span class=\"C1_word_gram\">[V n prep/adv] [V n adj]</span></div><ul><li><p class=\"C1_sentence_en\">She kept her money under the mattress...</p><p>她把钱放在床垫下。</p></li><li><p class=\"C1_sentence_en\">She remembered where she kept the gun...</p><p>她记得放枪的地方。</p></li><li><p class=\"C1_sentence_en\">To make it easier to contact us, <span class=\"C1_text_blue\">keep</span> this card handy.</p><p>把这张卡放在手边,以便于和我们联系。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">11</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">遵守;笃守;恪守;</span>When you <span class=\"C1_inline_word\">keep</span> something such as a promise or an appointment, you do what you said you would do. <span class=\"C1_word_gram\">[V n]</span></div><ul><li><p class=\"C1_sentence_en\">I'm hoping you'll <span class=\"C1_text_blue\">keep</span> your promise to come for a long visit...</p><p>我希望你遵守诺言来这儿多呆几天。</p></li><li><p class=\"C1_sentence_en\">He had again failed to <span class=\"C1_text_blue\">keep</span> his word.</p><p>他又食言了。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">12</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">记下;记录;记载;</span>If you <span class=\"C1_inline_word\">keep</span> a record of a series of events, you write down details of it so that they can be referred to later. <span class=\"C1_word_gram\">[V n]</span></div><ul><li><p class=\"C1_sentence_en\">Eleanor began to <span class=\"C1_text_blue\">keep</span> a diary...</p><p>埃莉诺开始记日记了。</p></li><li><p class=\"C1_sentence_en\">The volunteers kept a record of everything they ate for a week.</p><p>志愿者记录下他们一周所吃的所有食物。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">13</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">供养;抚养;养活;</span>If you <span class=\"C1_inline_word\">keep</span> yourself or <span class=\"C1_inline_word\">keep</span> someone else, you support yourself or the other person by earning enough money to provide food, clothing, money, and other necessary things. <span class=\"C1_word_gram\">[V n] [V pron-refl] [V n in n]</span></div><ul><li><p class=\"C1_sentence_en\">She could just about afford to <span class=\"C1_text_blue\">keep</span> her five kids...</p><p>她勉勉强强能养得起自己的5个孩子。</p></li><li><p class=\"C1_sentence_en\">I just cannot afford to <span class=\"C1_text_blue\">keep</span> myself...</p><p>我难以维持生计。</p></li><li><p class=\"C1_sentence_en\">The pay was enough to <span class=\"C1_text_blue\">keep</span> him in whisky for a day or two.</p><p>这笔钱够他喝一两天威士忌了。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">14</a></span><span class=\"C1_explanation_label\">[N-SING 单数名词] </span><span class=\"C1_text_blue\">生活费用;</span>Someone's <span class=\"C1_inline_word\">keep</span> is the cost of food and other things that they need in their daily life. <span class=\"C1_word_gram\">[poss N]</span></div><ul><li><p class=\"C1_sentence_en\">Ray will earn his <span class=\"C1_text_blue\">keep</span> on local farms while studying...</p><p>雷求学期间会在当地的农场干活赚取生活费。</p></li><li><p class=\"C1_sentence_en\">I need to give my parents money for my <span class=\"C1_text_blue\">keep</span>.</p><p>我需要付给父母我的生活费。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">15</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">饲养;</span>If you <span class=\"C1_inline_word\">keep</span> animals, you own them and take care of them. <span class=\"C1_word_gram\">[V n] [V n as n]</span></div><ul><li><p class=\"C1_sentence_en\">I've brought you some eggs. We <span class=\"C1_text_blue\">keep</span> chickens...</p><p>我给你带了些鸡蛋。我们养鸡。</p></li><li><p class=\"C1_sentence_en\">This mad writer kept a lobster as a pet.</p><p>这个疯狂的作家把龙虾当宠物养。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">16</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">开设;经营;管理;</span>If you <span class=\"C1_inline_word\">keep</span> a business such as a small shop or hotel, you own it and manage it. <span class=\"C1_word_gram\">[V n]</span></div><ul><li><p class=\"C1_sentence_en\">His father kept a village shop.</p><p>他父亲经营一家乡村商店。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">17</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">使耽搁;使延误;</span>If someone or something <span class=\"C1_inline_word\">keeps</span> you, they delay you and make you late. <span class=\"C1_word_gram\">[V n]</span></div><ul><li><p class=\"C1_sentence_en\">Sorry to <span class=\"C1_text_blue\">keep</span> you, Jack...</p><p>很抱歉让你久等了,杰克。</p></li><li><p class=\"C1_sentence_en\">'What kept you?' — 'I went in the wrong direction.'</p><p>“你为什么晚了?”——“我走错了方向。”</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">18</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">食物保持不坏;</span>If food <span class=\"C1_inline_word\">keeps</span> for a certain length of time, it stays fresh and suitable to eat for that time. <span class=\"C1_word_gram\">[V]</span></div><ul><li><p class=\"C1_sentence_en\">Whatever is left over may be put into the refrigerator, where it will <span class=\"C1_text_blue\">keep</span> for 2-3 weeks.</p><p>剩下的东西都可以放进冰箱,可以保持两到三个星期不坏。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">19</a></span><span class=\"C1_explanation_label\">[VERB 动词] </span><span class=\"C1_text_blue\">用于询问健康状况保持健康;</span>You can say or ask how someone <span class=\"C1_inline_word\">is keeping</span> as a way of saying or asking whether they are well. <span class=\"C1_word_gram\">[V adv] [only cont]</span></div><ul><li><p class=\"C1_sentence_en\">She hasn't been <span class=\"C1_text_blue\">keep</span>ing too well lately...</p><p>她最近身体不太好。</p></li><li><p class=\"C1_sentence_en\">How are you <span class=\"C1_text_blue\">keep</span>ing these days?</p><p>你这些天身体怎么样?</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">20</a></span><span class=\"C1_explanation_label\">[N-COUNT 可数名词] </span><span class=\"C1_text_blue\">中世纪的城堡主楼;</span>A <span class=\"C1_inline_word\">keep</span> is the main tower of a medieval castle, in which people lived. </div></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">21</a></span><span class=\"C1_explanation_label\">[PHRASE 短语] </span><span class=\"C1_text_blue\">继续做;坚持干;</span>If you <span class=\"C1_inline_word\">keep at it</span>, you continue doing something that you have started, even if you are tired and would prefer to stop. <span class=\"C1_word_gram\">[V inflects]</span></div><ul><li><p class=\"C1_sentence_en\">It may take a number of attempts, but it is worth <span class=\"C1_text_blue\">keep</span>ing at it...</p><p>可能要试几次,但还是值得坚持的。</p></li><li><p class=\"C1_sentence_en\">'Keep at it!' Thade encouraged me.</p><p>“坚持下去!”萨德鼓励我道。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">22</a></span><span class=\"C1_explanation_label\">[PHRASE 短语] </span><span class=\"C1_text_blue\">永远;永不更改地;</span>Something that is <span class=\"C1_inline_word\">for keeps</span> is permanent and will not change. <span class=\"C1_word_gram\">[v-link PHR] [Informal]</span></div><ul><li><p class=\"C1_sentence_en\">Ensure that whatever you gain now will be for <span class=\"C1_text_blue\">keep</span>s...</p><p>确保你现在所获得的一切永远不会失去。</p></li><li><p class=\"C1_sentence_en\">He advised them to leave town for <span class=\"C1_text_blue\">keep</span>s.</p><p>他建议他们离开镇子,永远别再回来。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">23</a></span><span class=\"C1_explanation_label\">[PHRASE 短语] </span><span class=\"C1_text_blue\">继续移动;坚持干;</span>If you <span class=\"C1_inline_word\">keep going</span>, you continue moving along or doing something that you have started, even if you are tired and would prefer to stop. <span class=\"C1_word_gram\">[keep inflects]</span></div><ul><li><p class=\"C1_sentence_en\">She forced herself to <span class=\"C1_text_blue\">keep</span> going...</p><p>她强迫自己继续下去。</p></li><li><p class=\"C1_sentence_en\">I was shouting: 'Keep going, <span class=\"C1_text_blue\">keep</span> going!'</p><p>我喊着:“坚持,坚持!”</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">24</a></span><span class=\"C1_explanation_label\">[PHRASE 短语] </span><span class=\"C1_text_blue\">协调/不协调;一致/不一致;</span>If one thing is <span class=\"C1_inline_word\">in keeping with</span> another, it is suitable in relation to that thing. If one thing is <span class=\"C1_inline_word\">out of keeping with</span> another, it is not suitable in relation to that thing. <span class=\"C1_word_gram\">[v-link PHR]</span></div><ul><li><p class=\"C1_sentence_en\">His office was in <span class=\"C1_text_blue\">keep</span>ing with his station and experience...</p><p>他的办公室与其身份和阅历相称。</p></li><li><p class=\"C1_sentence_en\">In <span class=\"C1_text_blue\">keep</span>ing with tradition, the Emperor and Empress did not attend the ceremony...</p><p>按照传统,皇帝和皇后未参加该仪式。</p></li><li><p class=\"C1_sentence_en\">His own response to it seemed to be out of <span class=\"C1_text_blue\">keep</span>ing with his earlier expressed opinions.</p><p>他自己对此的反应与其早前表达的看法并不一致。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">25</a></span><span class=\"C1_explanation_label\">[PHRASE 短语] </span><span class=\"C1_text_blue\">继续努力;</span>If you <span class=\"C1_inline_word\">keep it up</span>, you continue working or trying as hard as you have been in the past. <span class=\"C1_word_gram\">[V inflects]</span></div><ul><li><p class=\"C1_sentence_en\">There are fears that he will not be able to <span class=\"C1_text_blue\">keep</span> it up when he gets to the particularly demanding third year...</p><p>有人担心他到了要求极其严格的第3年时会坚持不下去。</p></li><li><p class=\"C1_sentence_en\">You're doing a great job! Keep it up!</p><p>你们干得非常棒!继续好好干吧!</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">26</a></span><span class=\"C1_explanation_label\">[PHRASE 短语] </span><span class=\"C1_text_blue\">把…秘而不宣;不将…说出去;</span>If you <span class=\"C1_inline_word\">keep</span> something <span class=\"C1_inline_word\">to yourself</span>, you do not tell anyone else about it. <span class=\"C1_word_gram\">[V inflects]</span></div><ul><li><p class=\"C1_sentence_en\">I have to tell someone. I can't <span class=\"C1_text_blue\">keep</span> it to myself...</p><p>我得找人说说。我心里憋不住。</p></li><li><p class=\"C1_sentence_en\">There's one thing you can do for me. But <span class=\"C1_text_blue\">keep</span> it to yourself.</p><p>有件事你能帮我做。但你要保密。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">27</a></span><span class=\"C1_explanation_label\">[PHRASE 短语] </span><span class=\"C1_text_blue\">离群索居;不与人来往;</span>If you <span class=\"C1_inline_word\">keep yourself to yourself</span> or <span class=\"C1_inline_word\">keep to yourself</span>, you stay on your own most of the time and do not mix socially with other people. <span class=\"C1_word_gram\">[V inflects]</span></div><ul><li><p class=\"C1_sentence_en\">He was a quiet man who kept himself to himself...</p><p>他是个喜欢安静、不爱与人来往的人。</p></li><li><p class=\"C1_sentence_en\">Since she knows little Italian, she <span class=\"C1_text_blue\">keep</span>s to herself.</p><p>因为不怎么懂意大利语,她很少和人交往。</p></li></ul></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><span class=\"C1_item_number\"><a href=\"entry://#page_top\">28</a></span><span class=\"C1_plus_character\">+ + +</span></div></div><div class=\"C1_see_other_box\"><p class=\"C1_see_other_word\"> to <span class=\"C1_inline_word\">keep</span> someone <span class=\"C1_inline_word\">company</span><span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://company\">company</a></p><p class=\"C1_see_other_word\">to keep your end up<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://end\">end</a></p><p class=\"C1_see_other_word\">to keep a straight face<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://face\">face</a></p><p class=\"C1_see_other_word\">to keep your hand in<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://hand\">hand</a></p><p class=\"C1_see_other_word\">to keep your head<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://head\">head</a></p><p class=\"C1_see_other_word\">to keep house<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://house\">house</a></p><p class=\"C1_see_other_word\">to keep pace<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://pace\">pace</a></p><p class=\"C1_see_other_word\">to keep the peace<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://peace\">peace</a></p><p class=\"C1_see_other_word\">to keep a secret<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://secret\">secret</a></p><p class=\"C1_see_other_word\">to keep time<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://time\">time</a></p><p class=\"C1_see_other_word\">to keep track<span class=\"C1_see_label\">&raquo;&nbsp;see:</span><a href=\"entry://track\">track</a></p></div><div class=\"C1_explanation_item\"><div class=\"C1_explanation_box\"><dl class=\"phrasal_verb_box\"><dt>相关词组:</dt><dd><a class=\"C1_explain\" href=\"entry://keep back\">keep back</a> <a class=\"C1_explain\" href=\"entry://keep down\">keep down</a> <a class=\"C1_explain\" href=\"entry://keep in with\">keep in with</a> <a class=\"C1_explain\" href=\"entry://keep on\">keep on</a> <a class=\"C1_explain\" href=\"entry://keep on about\">keep on about</a> <a class=\"C1_explain\" href=\"entry://keep on at\">keep on at</a> <a class=\"C1_explain\" href=\"entry://keep to\">keep to</a> <a class=\"C1_explain\" href=\"entry://keep up\">keep up</a> </dd></dl></div></div></div></div></div></body>"; // result will be an iterator over tuples containing the start and end indices for each match in the string let result = regex.captures_iter(string); for mat in result { println!("{:?}", mat); } }

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 Rust, please visit: https://docs.rs/regex/latest/regex/