List Info

Thread: nested brackets with javascript




nested brackets with javascript
user name
2006-03-04 14:18:51
Dear all,

I am trying to scrape BibTeX entries from web-pages using
javascript
(from within a firefox extension)
A single entry looks roughly like this:

resourceType{
field1 = aValue,
field2 = "value with quotation marks",
field3 = "value with quotation mark and  in
the field value",
field4 = ,
lastfield = "should not have a delimiting comma, but
some generators do
anyhow"
}

(many more entries like above)

for starters, I am trying to get all the entries from a
page.

using a simple
/([\s\S]+?){[\s\S]+?}/gim
unfortunatly stops greedyly at entries that include }
brackets.

I am not very familiar with regexp in general, so maybe
there's some
fundamental things I do not get right.
Can anybody of you help me?
Thanks a lot in advance


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

nested brackets with javascript
user name
2006-03-04 14:54:05
for those not familiar with ***BibTeX entries*** can u say
exactly WHAT
u'd like to match/fetch/replace in

resourceType{
field1 = aValue,
field2 = "value with quotation marks",
field3 = "value with quotation mark and  in
the field value",

field4 = ,
lastfield = "should not have a delimiting comma, but
some generators do

anyhow" 
}

it'd help a lot.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

nested brackets with javascript
user name
2006-03-04 15:20:02
On 3/4/06, tyler.durdongmail.com <tyler.durdongmail.com> wrote:
>
> using a simple
> /([\s\S]+?){[\s\S]+?}/gim
> unfortunatly stops greedyly at entries that include }
brackets.

You could look for that last bracket as ^\}$ -- assuming
it's on its
own line.  ^ anchors at the start of the line, $ at the end.

--
Remember, no matter where you go, there you are. -Buckaroo
Banzai
Online Regex find/repalce utility: http://rereplace.com
Command-based online image editor: http://theprawn.com/imag
iine

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

nested brackets with javascript
user name
2006-03-04 18:22:10
what I want to do is get an array of many resourceType{*everything
inside*}
and then dissect them further (this then is a piece of cake
like

*pattern fieldlabel*  = *pattern fieldvalue*

)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )