Link to home
Create AccountLog in
Avatar of PeteEngineer
PeteEngineerFlag for India

asked on

how to extract a pattern \"dd'/'MM'/'yyyy \" from a var?

i have a variable abc....in that i have a value        "asdasdasasd \"dd'/'MM'/'yyyy  \"sdfsdfsdfsdf"
i need to extract the value \"dd'/'MM'/'yyyy  \" from above javascript variable

how i can do it ?

is trim allow to do so?
Avatar of Om Prakash
Om Prakash
Flag of India image

You can use the Split function and split string by "\".

http://www.w3schools.com/jsref/jsref_split.asp
Avatar of Proculopsis
Proculopsis


// Try:

var abc = "asdasdasasd \"dd'/'MM'/'yyyy  \"sdfsdfsdfsdf";
alert( abc.split('"')[1] );
Avatar of PeteEngineer

ASKER

sorry this is my actual string :

"<text order=\"d,m,y\" formatstring=\"dd'/'MM'/'yyyy  \"/>

and what i need to check whether the string has dd/mm/yyyy format not mm/dd/yyyy format

split gives so many splitted values ...how i can extract that particular text \"dd'/'MM'/'yyyy  \"  
Avatar of Michel Plungjan
@Proculopsis: You mean

alert( abc.split('\\')[1] );
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks very much !! :-)