# Can Anyone help with Regex

**URL:** <https://group.classcentral.com/t/can-anyone-help-with-regex/23521>\
**Category:** JavaScript Bootcamp\
**Created:** [January 28, 2022, 1:07pm UTC](https://group.classcentral.com/t/can-anyone-help-with-regex/23521 "2022-01-28T13:07:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenanazzubayd2671382](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jenanazzubayd2671382](https://group.classcentral.com/u/jenanazzubayd2671382)\
**Post date:** [January 28, 2022, 1:07pm UTC](https://group.classcentral.com/t/can-anyone-help-with-regex/23521/1 "2022-01-28T13:07:12Z")

</div>

The function bellow replaces a Fahrenheit degree with its Celsius equivalent:

function f2c(x) {  
function convert(str, p1, offset, s) {  
return ((p1 - 32) \* 5/9) + ‘C’;  
}  
let s = String(x);  
// Can not understand Regex bellow  
let test = /(-?\d+(?:.\d\*)?)F\b/g;  
return s.replace(test, convert);  
}

---

<div class="post-metadata">

**Author:** ![wendykaramath496882](https://sea2.discourse-cdn.com/flex016/user_avatar/group.classcentral.com/wendykaramath496882/32/1107_2.png) [@wendykaramath496882](https://group.classcentral.com/u/wendykaramath496882)\
**Post date:** [January 29, 2022, 1:04am UTC](https://group.classcentral.com/t/can-anyone-help-with-regex/23521/2 "2022-01-29T01:04:41Z")

</div>

Oh I think I have done something like this before in my GitHub. I’ll check and get back to you if I have it

---

<div class="post-metadata">

**Author:** ![johannesvansc2679278](https://sea2.discourse-cdn.com/flex016/user_avatar/group.classcentral.com/johannesvansc2679278/32/2989_2.png) [@johannesvansc2679278](https://group.classcentral.com/u/johannesvansc2679278)\
**Post date:** [January 29, 2022, 2:44pm UTC](https://group.classcentral.com/t/can-anyone-help-with-regex/23521/3 "2022-01-29T14:44:50Z")

</div>

Hi,  
Use [https://regexper.com](https://regexper.com), it clears it up  
This is what I understand from it:  
optionally look for a - (minus) \> one or more digits \> optionally any character \> and optionally one or more digits \> finally for F  
-2F, 2F, -30F, 30F, -2.2F, 2.2F, -30.7F, 30.7F  
the \b word boundary I suppose the end of the input?

---

<div class="post-metadata">

**Author:** ![jenanazzubayd2671382](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jenanazzubayd2671382](https://group.classcentral.com/u/jenanazzubayd2671382)\
**Post date:** [January 30, 2022, 12:22pm UTC](https://group.classcentral.com/t/can-anyone-help-with-regex/23521/4 "2022-01-30T12:22:17Z")

</div>

Hi,  
This expression ​(?:.\d\*) confused me when ? comes first then : means any charecter?  
Why does not come after (:.)  
Thank you anyway

---

<div class="post-metadata">

**Author:** ![carlost2672543](https://sea2.discourse-cdn.com/flex016/user_avatar/group.classcentral.com/carlost2672543/32/4162_2.png) [@carlost2672543](https://group.classcentral.com/u/carlost2672543)\
**Post date:** [February 4, 2022, 11:40am UTC](https://group.classcentral.com/t/can-anyone-help-with-regex/23521/5 "2022-02-04T11:40:09Z")

</div>

Hi @jenanazzubayd2671382

I have not much time to help you right now and I am still learning this too but you might want to check this. Its probably what you wanted to know:  
MDN: " (?:x)  
Non-capturing group:  
Matches “x” but does not remember the match. The matched substring cannot be recalled from the resulting array’s elements ( `[1], ..., [n]` ) or from the predefined `RegExp` object’s properties ( `$1, ..., $9` )."

The link is here, I hope that helps: [Regular expression syntax cheatsheet - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet)

Happy coding! 😄  
P.S. And don’t be too hard with yourself and move on, back to that later, I am sure you’ll figure it out. ✊

---

<div class="post-metadata">

**Author:** ![jenanazzubayd2671382](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jenanazzubayd2671382](https://group.classcentral.com/u/jenanazzubayd2671382)\
**Post date:** [February 5, 2022, 8:30am UTC](https://group.classcentral.com/t/can-anyone-help-with-regex/23521/6 "2022-02-05T08:30:25Z")

</div>

Hi, thanks a lot I will check the link , also this example form MDN  
I know they are hard to remember but try to practice 🙂
