0

in iframe i'm loading external page and i want to use regex for get numeric . for example after loading iframe i have this content:

var urlToShow = 'http://my.site.com/go.php?user=454&code=3676ad29a406bc4461530d5a5859af43288bc3b9';

i want to get code value such as: 3676ad29a406bc4461530d5a5859af43288bc3b9 from that. how to access to iframe and get that with jQuery RegEx?

4
  • 1
    Could you share us your HTML? Commented May 19, 2014 at 10:34
  • @naota. thats popup window and only each ip can twice load page. i'm update post Commented May 19, 2014 at 10:36
  • Try using .contents() method - api.jquery.com/contents remember the same origin policy for iframe src Commented May 19, 2014 at 10:42
  • @Dipaks i want to use regex to get numerci after code from generated code into iframe Commented May 19, 2014 at 10:46

1 Answer 1

1

You can use the following regex to get the code value using the regex's search method:

/code=(\w+)/

The first captured group ($1 or \1) will contain the code value.

DEMO

Sign up to request clarification or add additional context in comments.

2 Comments

thanks. how to use that? patt = new RegExp('/code=(\w+)/',text); is not correct
this link can not help me and i can not get numeric after code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.