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>
                            主站蜘蛛池模板: 酵素生产厂家_酵素OEM_酵素加盟_酵素ODM_酵素原料厂家_厦门益力康 | 广东佛电电器有限公司|防雷开关|故障电弧断路器|智能量测断路器 广东西屋电气有限公司-广东西屋电气有限公司 | 阴离子_阳离子聚丙烯酰胺厂家_聚合氯化铝价格_水处理絮凝剂_巩义市江源净水材料有限公司 | 欧美日韩国产一区二区三区不_久久久久国产精品无码不卡_亚洲欧洲美洲无码精品AV_精品一区美女视频_日韩黄色性爱一级视频_日本五十路人妻斩_国产99视频免费精品是看4_亚洲中文字幕无码一二三四区_国产小萍萍挤奶喷奶水_亚洲另类精品无码在线一区 | 上海平衡机-单面卧式动平衡机-万向节动平衡机-圈带动平衡机厂家-上海申岢动平衡机制造有限公司 | 东莞压铸厂_精密压铸_锌合金压铸_铝合金压铸_压铸件加工_东莞祥宇金属制品 | 新疆散热器,新疆暖气片,新疆电锅炉,光耀暖通公司 | 砍排机-锯骨机-冻肉切丁机-熟肉切片机-预制菜生产线一站式服务厂商 - 广州市祥九瑞盈机械设备有限公司 | 水成膜泡沫灭火剂_氟蛋白泡沫液_河南新乡骏华消防科技厂家 | 卫浴散热器,卫浴暖气片,卫生间背篓暖气片,华圣格浴室暖气片 | 走心机厂家,数控走心机-台州博城智能科技有限公司 | 影合社-影视人的内容合作平台| 首页_欧瑞传动官方网站--主营变频器、伺服系统、新能源、软起动器、PLC、HMI | 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 油漆辅料厂家_阴阳脚线_艺术漆厂家_内外墙涂料施工_乳胶漆专用防霉腻子粉_轻质粉刷石膏-魔法涂涂 | 报警器_家用防盗报警器_烟雾报警器_燃气报警器_防盗报警系统厂家-深圳市刻锐智能科技有限公司 | 郑州水质检测中心_井水检测_河南废气检测_河南中环嘉创检测 | 深圳标识制作公司-标识标牌厂家-深圳广告标识制作-玟璟广告-深圳市玟璟广告有限公司 | YAGEO国巨电容|贴片电阻|电容价格|三星代理商-深圳市巨优电子有限公司 | 招商帮-一站式网络营销服务|互联网整合营销|网络推广代运营|信息流推广|招商帮企业招商好帮手|搜索营销推广|短视视频营销推广 | 全温恒温摇床-水浴气浴恒温摇床-光照恒温培养摇床-常州金坛精达仪器制造有限公司 | 江西自考网| CE认证_FCC认证_CCC认证_MFI认证_UN38.3认证-微测检测 CNAS实验室 | 电动打包机_气动打包机_钢带捆扎机_废纸打包机_手动捆扎机 | 四探针电阻率测试仪-振实密度仪-粉末流动性测定仪-宁波瑞柯微智能 | 工程管道/塑料管材/pvc排水管/ppr给水管/pe双壁波纹管等品牌管材批发厂家-河南洁尔康建材 | 博莱特空压机|博莱特-阿特拉斯独资空压机品牌核心代理商 | 三效蒸发器_多效蒸发器价格_四效三效蒸发器厂家-青岛康景辉 | 二手Sciex液质联用仪-岛津气质联用仪-二手安捷伦气质联用仪-上海隐智科学仪器有限公司 | 武汉高低温试验机-现货恒温恒湿试验箱-高低温湿热交变箱价格-湖北高天试验设备 | 阻垢剂,反渗透阻垢剂,缓蚀阻垢剂-山东普尼奥水处理科技有限公司 真空粉体取样阀,电动楔式闸阀,电动针型阀-耐苛尔(上海)自动化仪表有限公司 | 不锈钢散热器,冷却翅片管散热器厂家-无锡市烨晟化工装备科技有限公司 | 上海律师咨询_上海法律在线咨询免费_找对口律师上策法网-策法网 广东高华家具-公寓床|学生宿舍双层铁床厂家【质保十年】 | 东莞螺丝|东莞螺丝厂|东莞不锈钢螺丝|东莞组合螺丝|东莞精密螺丝厂家-东莞利浩五金专业紧固件厂家 | 代办建筑资质升级-建筑资质延期就找上海国信启航 | 冷热冲击试验箱_温度冲击试验箱价格_冷热冲击箱排名_林频厂家 | 北京律师咨询_知名专业北京律师事务所_免费法律咨询 | 钢板仓,大型钢板仓,钢板库,大型钢板库,粉煤灰钢板仓,螺旋钢板仓,螺旋卷板仓,骨料钢板仓 | 灌装封尾机_胶水灌装机_软管灌装封尾机_无锡和博自动化机械制造有限公司 | 高压负荷开关-苏州雷尔沃电器有限公司 | 钣金加工厂家-钣金加工-佛山钣金厂-月汇好 |