---
title: "Need a regex to get font name and weight in a google fonts stylesheet path"  
description: "Need a regex to get font name and weight in a google fonts stylesheet path"  
author: "Anonymous User"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1594/need-a-regex-to-get-font-name-and-weight-in-a-google-fonts-stylesheet-path  
category: "html5"  
tags: ["html5"]  
reading_time: 1 minute  

---

# Need a regex to get font name and weight in a google fonts stylesheet path

Let's [say](https://answers.mindstick.com/qa/116645/a1-wreckers-reviews-what-do-customers-say) I have this [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp):

```
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,600,700" rel="stylesheet" type="text/css">
```

I need to [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) the [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) before and after "Open+Sans:400italic,400,300,600,700" Any of you [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)-wizards who knows how to make a [regex](https://www.mindstick.com/forum/160352/how-to-use-regex-in-javascript-for-pattern-matching) for this? Or is there a better way than using

## Replies

### Reply by Anonymous User

A Perl style regex perhaps too much crafted for your example:

```
s/<link href="[^"]*family=([^"]*)".*/$1/
```


---

Original Source: https://www.mindstick.com/forum/1594/need-a-regex-to-get-font-name-and-weight-in-a-google-fonts-stylesheet-path

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
