正则表达式匹配: [英] Regular expression Match :

查看:179
本文介绍了正则表达式匹配:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,

我有一些数据,如mg-st-005.xyz.pqr.dyd。

我想要字符串mg-st-005 (第一个。之前的字符串。(点))。

我的preg_match无法正常工作....

你可以帮我吗?
谢谢...

Hey all,
I have some data like mg-st-005.xyz.pqr.dyd .
I want to have the string mg-st-005 ( string before the first "."(dot)).
My preg_match does not work properly....
can you please help me?
Thanks...

推荐答案

什么是''preg_match''即什么是代码及其目的?

你刚刚在第一个''之后检索字符串信息的代码之后'。'?
what is ''preg_match'' ie what is the code and its purpose?
are you just after code that will retrieve the string information before the first ''.''?



什么是''preg_match''即什么是代码及其目的?

你刚刚在第一个''之前检索字符串信息的代码之后。''?
what is ''preg_match'' ie what is the code and its purpose?
are you just after code that will retrieve the string information before the first ''.''?



嘿leeogrady,

是的,我只想在第一个。之前输入字符串。

为此,我使用了preg match ..

我的代码是,

hey leeogrady,
yes, I just wanted to have the string before the first ".".
And for that I used preg match..
My code was,

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


我仍然不确定preg_match是什么,但我认为有更好的方法...

我会使用strtok()内置函数给PHP

代码类似于:
I am still not sure what preg_match is, but i think there is a better way...
I would use strtok() a built in function to PHP
the code is something like:
展开 | 选择 | Wrap | 行号


这篇关于正则表达式匹配:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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