I want some specific characters from the link [duplicate] - javascript

This question already has answers here:
How to obtain the query string from the current URL with JavaScript?
(19 answers)
How can I get query string values in JavaScript?
(73 answers)
Closed 3 months ago.
The link like this i want only this suyashvashishtha#axl and this address can be dynamic eg: anyaddress0005446556#axl,newaddress#axl i only want this character from pa= to &. Please help me.
upi://pay?pa=suyashvashishtha#axl&pn=Suyash%20Vashishtha&mc=0000&mode=02&purpose=00
I was splitting it but the address is dynamic of different users this method is not working..

Related

Is there a better alternative to slice? [duplicate]

This question already has answers here:
Parse query string in JavaScript [duplicate]
(11 answers)
How can I get query string values in JavaScript?
(73 answers)
Closed 9 months ago.
I'm kind of new to javascript and I was wondering if there was a better alternative to slice. I'm currently using window.location.slice at the moment and it feels like I could be using a better alternative. If you've ever used express.js you might have heard of "req.query.id", something like that in raw javascript would be perfect. Thanks, Alek.

VUE JS: If I had a string such as "8^3", how would I store 8 and 3 as two separate variables? [duplicate]

This question already has answers here:
How do I split a string, breaking at a particular character?
(17 answers)
Javascript to convert string to number? [duplicate]
(4 answers)
Closed 2 years ago.
I'm creating a calculator using VUE JS. I was wondering how to do exponents in that if I had something like "8^3", how would I split the string into the two separate digits?

Regular Expression: Get file extension from string [duplicate]

This question already has answers here:
How can I get query string values in JavaScript?
(73 answers)
Get the values from the "GET" parameters (JavaScript) [duplicate]
(63 answers)
Closed 2 years ago.
I have a link (string) which contains a filename. I need to extract the format of the filename but I am unfortunately not able to do that. An example link is given below
www.xyz.com/private/videos/89FDJKDKFgrFTD-MUyKE9Sn/source?file-name=SampleAudio_0.4mb.mp3&token=exp=1591202847~acl=/private/videos/8OJFREFJOIJFREJ-MUyKE9Sn/source*~hmac=aef161514cdfodsjfodsjorjef081b4c849b8c29c6a37339803866badfd4a16
I have tried multiple ways like to look for .(dot) until & but since I am new to this I couldn't make this work. I got the filename through name=([^&]*) but could not get the extension. Is there a way to do this?
You can use this regex:
(?:file-name=.*)(\..+)(?:&)
Also see working example: https://regex101.com/r/CJDXLW/2

Regex to take only domain specific email [duplicate]

This question already has answers here:
How to match all email addresses at a specific domain using regex?
(5 answers)
Closed 7 years ago.
I have written one regex to take only email domain as yahoo.com.
"^[a-zA-Z0-9]+#yahoo\.com$"
but when i enter amit.sahay#yahoo.com, it says invalid email id.
Please help.
Thanks.
You didn't added .(dot) within your character class over here so your updated regex would be
^[a-zA-Z0-9.]+#yahoo\.com$
//^^ added (.dot) over here

validating a url using Regex in javascript [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Validate email address in Javascript?
What is the best regular expression to check if a string is a valid URL?
I want to test that whether the string is url or not, right now I am stuck at this point.
I am using this regex to validate my URL
/(https|http):\/\/([_a-z\d\-]+(\.[_a-z\d\-]+)+)(([_a-z\d\-\\\.\/]+[_a-z\d\-\\\/])+)*/;
The problem with this regex is that it fails to validate this type of URL
http://www.abc/abc/
how to check that case.?

Categories

Resources