Making regular expressions bold

I have some coordinates on my site that are printed as:

z:000

I would like to have this (including the z) printed in bold. The coordinates are in a text string like so:

$string = 'Lorem ipsum z:000 dolor sit amet';

I think I have to do this with Regex, but I'm not getting it to work. The first part is fixed, so the parts of the regex are ^z: and [0-9]

Answers


This should help

preg_replace("/(z:[0-9]{3})/", '<b>${1}</b>', $string);

Works for z:000 to z:999


Need Your Help

request.url is not giving complete url in nodejs

javascript node.js

I am running the following code snippet from the node js beginner book.

Convert Hash256 String Result to Uppercase?

c# php mysql

I'm trying to get a website Login page and a C# launcher to connect to a MySQL database, my C# code converts a string to SHA256 but in uppercase. So I figured it would be easier to change in PHP, so

Explicit type casting of object to int *

c++

What is the output of the following c++ code ?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.