Jump to content
toreachdeepak

preg_match issue

Recommended Posts

Hi,We are not able to understand the first string to be matched in the below preg_match function'/^exact:[\s\S]*Project Manager:$/'preg_match('/^exact:[\s\S]*Project Manager:$/',$this->selenium->getText("//div[@id=adminreport]/div/form/table/tbody/tr[6]/td[1]/b"))===========================================================================^: Start of string$: end of string1. What is the meaning of exact ?2. If * has a special meaning why it is not coming \*

Share this post


Link to post
Share on other sites
1. What is the meaning of exact ?
No special meaning - ^exact tells it to match anything but e, then x, then a, then c, then t.
2. If * has a special meaning why it is not coming \*
Because the author of the expression wanted to use its special meaning, namely, to match 0 or more whitespace characters with [\s\S]*.

Share this post


Link to post
Share on other sites

Hrrm. Isn't [\s\S] just the same as a dot? As in, match everything that is a space and everything that is not a space?

Share this post


Link to post
Share on other sites

Heh, indeed it is.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...