如何在PHP PCRE中创建m修饰符?什么是多线? [英] How do I create a m modifier in PHP PCRE? And what is a multi line?

查看:87
本文介绍了如何在PHP PCRE中创建m修饰符?什么是多线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对m修饰符非常困惑,并且让它更加混乱,我对关键词多行感到困惑。这个词用于描述大多数来源的m修饰符



online。那么多线在使用m修饰符时意味着什么呢?多行多变量包含字符串或单词multi line是指在一个变量字符串中使用\ n命令多个新行?


并且是基于一个字符串的多行?如果任何人可以调整下面的代码示例,为我提供正确的代码结构,并且通过多行指的单词更好地理解,我我真的很感激。所以我可以理解m修饰符和PHP正则表达式中的多行使用这个词。



 <?php  
$ string = ' JavaScript很酷,我喜欢JavaScript。';
if(preg_match_all(' / JavaScript / m',$ string))
{
echo ' bla bla 1。 ;
}
其他
{
echo ' bla bla 2';
}
?>





< b>我尝试了什么:



在线解释但很少见的代码示例是在线提供商。

解决方案

string = ' JavaScript很酷,我喜欢JavaScript。' ;
if(preg_match_all(' / JavaScript / m'


string))
{
echo ' bla bla 1。';
}
其他
{
echo ' bla bla 2';
}
?>





< b>我尝试了什么:



在线解释但很少见的代码示例是在线提供商。


正则表达式选项| Microsoft Docs [ ^ ]

I am very confused about the m modifier and to make it more confusing i'm confused by the key word multi line. That word is used to describe the m modifier at most sources

online. So what does multi line mean in the use of a m modifier? Is a multi line multiple variables that contains strings or by the word multi line is it referring to

multiple new lines with the \n command in one variable string? And is multi line based on one string? If any one can adjust this code example below to give me the correct code structure for the m

modifier and a better understanding by the word multi line is referring to, I will really appreciate that. So I can understand the m modifier and the word multi line use in PHP regular expressions.

<?php
$string = 'JavaScript is cool and I love JavaScript.';
if(preg_match_all('/JavaScript/m',$string))
{
echo 'bla bla 1.';
}
else
{
echo 'bla bla 2';
}
?>



What I have tried:

Explained online but rare code examples of this is provider online.

解决方案

string = 'JavaScript is cool and I love JavaScript.'; if(preg_match_all('/JavaScript/m',


string)) { echo 'bla bla 1.'; } else { echo 'bla bla 2'; } ?>



What I have tried:

Explained online but rare code examples of this is provider online.


Regular Expression Options | Microsoft Docs[^]


这篇关于如何在PHP PCRE中创建m修饰符?什么是多线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆