Javascript Gurus In The House, Help A Learner. - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › Javascript Gurus In The House, Help A Learner. (682 Views)
| Javascript Gurus In The House, Help A Learner. by David(op): 11:15am On Apr 20, 2013 |
Please. How would can i search for words before a word in javascript. E.g if i want to search for words or number that comes before X. I.e 2X +5 THE output should be 2. I tried the regexp but didnt know how to go about it. Am a learner. Please help. Thanks. |
| Re: Javascript Gurus In The House, Help A Learner. by yawatide(f): 12:06pm On Apr 20, 2013 |
search for "javascript substring". Something should come up that will be of help to you. Good luck! |
| Re: Javascript Gurus In The House, Help A Learner. by Nobody: 12:09pm On Apr 20, 2013 |
giving you answers doesn't encourage programming instead it encourages this type of request, read more of regexp. thanks |
| Re: Javascript Gurus In The House, Help A Learner. by David(op): 7:08am On Apr 21, 2013 |
Yeah. Thanks i got a clue. Will be using the .split() function. |
| Re: Javascript Gurus In The House, Help A Learner. by yawatide(f): 12:02pm On Apr 21, 2013 |
I am thinking, based on your problem, split may not be the answer. There is a function (i blv it is substr) where you pass in a string and a starting and ending point, and it gives you the exact character(s) at the ending point. Split will give you characters based on a delimiter and return it as arrays. Think again and use the best option. good luck! |
| Re: Javascript Gurus In The House, Help A Learner. by Nobody: 12:15pm On Apr 21, 2013 |
substr is not right that only takes a segment of code that you know the pattern e.g 2x-5 but what of 5x-7+(2x + 5) regular expression fits the scenario perfectly. |
| Re: Javascript Gurus In The House, Help A Learner. by yawatide(f): 10:30pm On Apr 21, 2013 |
^^^ I guess it depends on the kinds of strings that OP wants to manipulate |
Gurus In The House I Need Your Honest Reviews • Where Are The Paypal Gurus In The House, Check This Out... • Help.... Opencart Gurus In The House • 2 • 3 • 4
Your Website In 3mins • Change Your " Sub-domain" To A Custom Domain. • Do You Make Enough Money From Addynamo Compared To Adsense?