Home Backend Development PHP Tutorial php 正则处置 两个字符串间的数据

php 正则处置 两个字符串间的数据

Jun 13, 2016 pm 01:16 PM
parent str string

php 正则处理 两个字符串间的数据

?

?

1

2

3

4

5

$str=' this is my string{parent_id} hello';

if( preg_match("/{(.+?)}/isU",$str,$res)) echo $res[1];

#print_r($res);

 

结果输出parent_id

Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Convert basic data types to strings using Java's String.valueOf() function Convert basic data types to strings using Java's String.valueOf() function Jul 24, 2023 pm 07:55 PM

Convert basic data types to strings using Java's String.valueOf() function

How to convert char array to string How to convert char array to string Jun 09, 2023 am 10:04 AM

How to convert char array to string

Use Java's String.replace() function to replace characters (strings) in a string Use Java's String.replace() function to replace characters (strings) in a string Jul 25, 2023 pm 05:16 PM

Use Java's String.replace() function to replace characters (strings) in a string

2w words detailed explanation String, yyds 2w words detailed explanation String, yyds Aug 24, 2023 pm 03:56 PM

2w words detailed explanation String, yyds

How to access parent class properties in Python? How to access parent class properties in Python? Aug 26, 2023 am 10:17 AM

How to access parent class properties in Python?

How to use the split method in Java String How to use the split method in Java String May 02, 2023 am 09:37 AM

How to use the split method in Java String

Use java's String.length() function to get the length of a string Use java's String.length() function to get the length of a string Jul 25, 2023 am 09:09 AM

Use java's String.length() function to get the length of a string

How to use java's String class How to use java's String class Apr 19, 2023 pm 01:19 PM

How to use java's String class

See all articles