pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <small id='dJP1k'></small><noframes id='dJP1k'>

    <legend id='dJP1k'><style id='dJP1k'><dir id='dJP1k'><q id='dJP1k'></q></dir></style></legend>
    • <bdo id='dJP1k'></bdo><ul id='dJP1k'></ul>

    1. <tfoot id='dJP1k'></tfoot>

      <i id='dJP1k'><tr id='dJP1k'><dt id='dJP1k'><q id='dJP1k'><span id='dJP1k'><b id='dJP1k'><form id='dJP1k'><ins id='dJP1k'></ins><ul id='dJP1k'></ul><sub id='dJP1k'></sub></form><legend id='dJP1k'></legend><bdo id='dJP1k'><pre id='dJP1k'><center id='dJP1k'></center></pre></bdo></b><th id='dJP1k'></th></span></q></dt></tr></i><div class="cmya2iu" id='dJP1k'><tfoot id='dJP1k'></tfoot><dl id='dJP1k'><fieldset id='dJP1k'></fieldset></dl></div>
      1. 如何以最聰明的方式替換 PHP 中不同的換行樣式

        How to replace different newline styles in PHP the smartest way?(如何以最聰明的方式替換 PHP 中不同的換行樣式?)
      2. <i id='YCLRM'><tr id='YCLRM'><dt id='YCLRM'><q id='YCLRM'><span id='YCLRM'><b id='YCLRM'><form id='YCLRM'><ins id='YCLRM'></ins><ul id='YCLRM'></ul><sub id='YCLRM'></sub></form><legend id='YCLRM'></legend><bdo id='YCLRM'><pre id='YCLRM'><center id='YCLRM'></center></pre></bdo></b><th id='YCLRM'></th></span></q></dt></tr></i><div class="iik0ywq" id='YCLRM'><tfoot id='YCLRM'></tfoot><dl id='YCLRM'><fieldset id='YCLRM'></fieldset></dl></div>
            <tbody id='YCLRM'></tbody>
          • <bdo id='YCLRM'></bdo><ul id='YCLRM'></ul>
            <legend id='YCLRM'><style id='YCLRM'><dir id='YCLRM'><q id='YCLRM'></q></dir></style></legend>

                <tfoot id='YCLRM'></tfoot>

                • <small id='YCLRM'></small><noframes id='YCLRM'>

                  本文介紹了如何以最聰明的方式替換 PHP 中不同的換行樣式?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有一個可能有不同換行樣式的文本.我想用相同的換行符替換所有換行符 ' ', ' ',' ' (在本例中為 ).

                  I have a text which might have different newline styles. I want to replace all newlines ' ', ' ',' ' with the same newline (in this case ).

                  最快的方法是什么?我目前的解決方案看起來很糟糕:

                  What's the fastest way to do this? My current solution looks like this which is way sucky:

                      $sNicetext = str_replace("
                  ",'%%%%somthing%%%%', $sNicetext);
                      $sNicetext = str_replace(array("
                  ","
                  "),array("
                  ","
                  "), $sNicetext);
                      $sNicetext = str_replace('%%%%somthing%%%%',"
                  ", $sNicetext);
                  

                  問題是你不能用一次替換來做到這一點,因為 將被復制到 .

                  Problem is that you can't do this with one replace because the will be duplicated to .

                  感謝您的幫助!

                  推薦答案

                  $string = preg_replace('~R~u', "
                  ", $string);
                  

                  如果您不想替換所有 Unicode 換行符而只想替換 CRLF 樣式的換行符,請使用:

                  If you don't want to replace all Unicode newlines but only CRLF style ones, use:

                  $string = preg_replace('~(*BSR_ANYCRLF)R~', "
                  ", $string);
                  

                  R 匹配這些換行符,u 是將輸入字符串視為 UTF-8 的修飾符.

                  R matches these newlines, u is a modifier to treat the input string as UTF-8.

                  來自 PCRE 文檔:

                  什么R匹配

                  What R matches

                  默認情況下,模式中的序列 R 匹配任何 Unicode 換行符序列,無論被選為行尾序列.如果你指定

                  By default, the sequence R in a pattern matches any Unicode newline sequence, whatever has been selected as the line ending sequence. If you specify

                       --enable-bsr-anycrlf
                  

                  默認值已更改,以便 R 僅匹配 CR、LF 或 CRLF.構建 PCRE 時選擇的任何內容都可以在庫時被覆蓋函數被調用.

                  the default is changed so that R matches only CR, LF, or CRLF. Whatever is selected when PCRE is built can be overridden when the library functions are called.

                  換行符序列

                  在字符類之外,默認情況下,轉義序列 R 匹配任何 Unicode 換行序列.在非 UTF-8 模式下,R 等價于以下:

                  Outside a character class, by default, the escape sequence R matches any Unicode newline sequence. In non-UTF-8 mode R is equivalent to the following:

                      (?>
                  |
                  |x0b|f|
                  |x85)
                  

                  這是一個原子組"的例子,給出了詳細信息以下.此特定組匹配兩個字符的序列CR 后跟 LF,或單個字符 LF 之一(換行、U+000A)、VT(垂直標簽、U+000B)、FF(換頁、U+000C)、CR(托架返回,U+000D)或 NEL(下一行,U+0085).兩個字符的序列被視為一個不可分割的單元.

                  This is an example of an "atomic group", details of which are given below. This particular group matches either the two-character sequence CR followed by LF, or one of the single characters LF (linefeed, U+000A), VT (vertical tab, U+000B), FF (formfeed, U+000C), CR (carriage return, U+000D), or NEL (next line, U+0085). The two-character sequence is treated as a single unit that cannot be split.

                  在 UTF-8 模式下,代碼點更大的兩個附加字符添加超過 255 個:LS(行分隔符,U+2028)和 PS(段落分隔符,U+2029).不需要 Unicode 字符屬性支持這些字符被識別.

                  In UTF-8 mode, two additional characters whose codepoints are greater than 255 are added: LS (line separator, U+2028) and PS (paragraph separator, U+2029). Unicode character property support is not needed for these characters to be recognized.

                  可以限制 R 只匹配 CR、LF 或 CRLF(而不是完整的 Unicode 行尾集)通過設置選項PCRE_BSR_ANYCRLF 在編譯時或模式匹配時.(BSR 是反斜杠 R"的縮寫.)這可以設為默認值PCRE 構建時;如果是這種情況,其他行為可以是通過 PCRE_BSR_UNICODE 選項請求.也可以通過使用以下選項之一啟動模式字符串來指定這些設置以下序列:

                  It is possible to restrict R to match only CR, LF, or CRLF (instead of the complete set of Unicode line endings) by setting the option PCRE_BSR_ANYCRLF either at compile time or when the pattern is matched. (BSR is an abbrevation for "backslash R".) This can be made the default when PCRE is built; if this is the case, the other behaviour can be requested via the PCRE_BSR_UNICODE option. It is also possible to specify these settings by starting a pattern string with one of the following sequences:

                      (*BSR_ANYCRLF)   CR, LF, or CRLF only
                      (*BSR_UNICODE)   any Unicode newline sequence
                  

                  這些覆蓋默認值和提供給 pcre_compile() 或的選項pcre_compile2(),但它們可以被提供給的選項覆蓋pcre_exec() 或 pcre_dfa_exec().請注意,這些特殊設置,其中與 Perl 不兼容,僅在開始時被識別模式,并且它們必須是大寫的.如果其中不止一個存在,則使用最后一個.它們可以結合改變換行約定;例如,一個模式可以以:

                  These override the default and the options given to pcre_compile() or pcre_compile2(), but they can be overridden by options given to pcre_exec() or pcre_dfa_exec(). Note that these special settings, which are not Perl-compatible, are recognized only at the very start of a pattern, and that they must be in upper case. If more than one of them is present, the last one is used. They can be combined with a change of newline convention; for example, a pattern can start with:

                      (*ANY)(*BSR_ANYCRLF)
                  

                  它們也可以與 (*UTF8) 或 (*UCP) 特殊序列組合.在字符類中,R 被視為無法識別的轉義序列,因此默認匹配字母R",但會導致錯誤如果設置了 PCRE_EXTRA.

                  They can also be combined with the (*UTF8) or (*UCP) special sequences. Inside a character class, R is treated as an unrecognized escape sequence, and so matches the letter "R" by default, but causes an error if PCRE_EXTRA is set.

                  這篇關于如何以最聰明的方式替換 PHP 中不同的換行樣式?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  enable SOAP on PHP(在 PHP 上啟用 SOAP)
                  Get received XML from PHP SOAP Server(從 PHP SOAP 服務器獲取接收到的 XML)
                  not a valid AllXsd value(不是有效的 AllXsd 值)
                  PHP SoapClient: SoapFault exception Could not connect to host(PHP SoapClient:SoapFault 異常無法連接到主機)
                  Implementation of P_SHA1 algorithm in PHP(PHP中P_SHA1算法的實現)
                  Sending a byte array from PHP to WCF(將字節數組從 PHP 發送到 WCF)
                  • <bdo id='BKerj'></bdo><ul id='BKerj'></ul>

                      <small id='BKerj'></small><noframes id='BKerj'>

                    1. <legend id='BKerj'><style id='BKerj'><dir id='BKerj'><q id='BKerj'></q></dir></style></legend>

                          <tbody id='BKerj'></tbody>
                        <tfoot id='BKerj'></tfoot>
                          • <i id='BKerj'><tr id='BKerj'><dt id='BKerj'><q id='BKerj'><span id='BKerj'><b id='BKerj'><form id='BKerj'><ins id='BKerj'></ins><ul id='BKerj'></ul><sub id='BKerj'></sub></form><legend id='BKerj'></legend><bdo id='BKerj'><pre id='BKerj'><center id='BKerj'></center></pre></bdo></b><th id='BKerj'></th></span></q></dt></tr></i><div class="u2ey2ua" id='BKerj'><tfoot id='BKerj'></tfoot><dl id='BKerj'><fieldset id='BKerj'></fieldset></dl></div>
                            主站蜘蛛池模板: MES系统工业智能终端_生产管理看板/安灯/ESOP/静电监控_讯鹏科技 | 钢绞线万能材料试验机-全自动恒应力两用机-混凝土恒应力压力试验机-北京科达京威科技发展有限公司 | 环境模拟实验室_液体-气体控温机_气体控温箱_无锡双润冷却科技有限公司 | 安全阀_弹簧式安全阀_美标安全阀_工业冷冻安全阀厂家-中国·阿司米阀门有限公司 | 氧化锆陶瓷_氧化锆陶瓷加工_氧化锆陶瓷生产厂家-康柏工业陶瓷有限公司 | 口臭的治疗方法,口臭怎么办,怎么除口臭,口臭的原因-口臭治疗网 | 七维官网-水性工业漆_轨道交通涂料_钢结构漆 | 震动筛选机|震动分筛机|筛粉机|振筛机|振荡筛-振动筛分设备专业生产厂家高服机械 | 网站seo优化_seo云优化_搜索引擎seo_启新网络服务中心 | BESWICK球阀,BESWICK接头,BURKERT膜片阀,美国SEL继电器-东莞市广联自动化科技有限公司 | 仓储笼_仓储货架_南京货架_仓储货架厂家_南京货架价格低-南京一品仓储设备制造公司 | 实木家具_实木家具定制_全屋定制_美式家具_圣蒂斯堡官网 | 酒万铺-酒水招商-酒水代理| 伊卡洛斯软装首页-电动窗帘,别墅窗帘,定制窗帘,江浙沪1000+别墅窗帘案例 | 不锈钢法兰-碳钢法兰-法兰盘生产加工厂家-[鼎捷峰]-不锈钢法兰-碳钢法兰-法兰盘生产加工厂家-[鼎捷峰] | AGV无人叉车_激光叉车AGV_仓储AGV小车_AGV无人搬运车-南昌IKV机器人有限公司[官网] | 薄壁轴承-等截面薄壁轴承生产厂家-洛阳薄壁精密轴承有限公司 | 软启动器-上海能曼电气有限公司 真空搅拌机-行星搅拌机-双行星动力混合机-广州市番禺区源创化工设备厂 | 浙江筋膜枪-按摩仪厂家-制造商-肩颈按摩仪哪家好-温州市合喜电子科技有限公司 | 喷涂流水线,涂装流水线,喷漆流水线-山东天意设备科技有限公司 | 慈溪麦田广告公司,提供慈溪广告设计。 | 井式炉-台车式回火炉-丹阳市电炉厂有限公司 | 盐城网络公司_盐城网站优化_盐城网站建设_盐城市启晨网络科技有限公司 | 精密机械零件加工_CNC加工_精密加工_数控车床加工_精密机械加工_机械零部件加工厂 | 商标转让-商标注册-商标查询-软著专利服务平台 - 赣江万网 | 400电话_400电话申请_888元包年_400电话办理服务中心_400VIP网 | 南京泽朗生物科技有限公司 | 欧盟ce检测认证_reach检测报告_第三方检测中心-深圳市威腾检验技术有限公司 | 球形钽粉_球形钨粉_纳米粉末_难熔金属粉末-广东银纳官网 | 阻垢剂-反渗透缓蚀阻垢剂厂家-山东鲁东环保科技有限公司 | 中空玻璃生产线,玻璃加工设备,全自动封胶线,铝条折弯机,双组份打胶机,丁基胶/卧式/立式全自动涂布机,玻璃设备-山东昌盛数控设备有限公司 | 超细粉碎机|超微气流磨|气流分级机|粉体改性设备|超微粉碎设备-山东埃尔派粉碎机厂家 | 球形钽粉_球形钨粉_纳米粉末_难熔金属粉末-广东银纳官网 | 尼龙PA610树脂,尼龙PA612树脂,尼龙PA1010树脂,透明尼龙-谷骐科技【官网】 | 涿州网站建设_网站设计_网站制作_做网站_固安良言多米网络公司 | 哈尔滨治「失眠/抑郁/焦虑症/精神心理」专科医院排行榜-京科脑康免费咨询 一对一诊疗 | 厂房出售_厂房仓库出租_写字楼招租_土地出售-中苣招商网-中苣招商网 | X光检测仪_食品金属异物检测机_X射线检测设备_微现检测 | 步进_伺服_行星减速机,微型直流电机,大功率直流电机-淄博冠意传动机械 | 艺术涂料_进口艺术涂料_艺术涂料加盟_艺术涂料十大品牌 -英国蒙太奇艺术涂料 | 工装定制/做厂家/公司_工装订做/制价格/费用-北京圣达信工装 |