Is there some kind a engine for Json in the Zend framework, What I mean is some abstraction that all the Json (ajax) responces go through ?
in other words some class to controll all the Ajax calls?
Alright so I want to grab the information on a website thats between
[usernames] and [/usernames]
I know how to get the string but how would I use regex to only have the information in the middle.
Remember I am going to be having more then one thing on the page.
I have a jQuery plugin that overrides link behavior, to allow Ajax loading of page content. Simple enough with a delegated event like $(document).on('click','a', function(){});.
but I only want it to apply to links that are not like these ones (Ajax loading is not applicable to them, so links like these need to behave normally):
target="_blank" // New browser window
href="#..." // Bookmark link (page is already loaded).
href="afs://..." // AFS file access.
href="cid://..." // Content identifiers for MIME body part.
href="file://..." // Specifies the address of a file from the locally accessible drive.
href="ftp://..." // Uses Internet File Transfer Protocol (FTP) to retrieve a file.
href="http://..." // The most commonly used access method.
href="https://..." // Provide some level of security of transmission
href="mailto://..." // Opens an email program.
href="mid://..." // The message identifier for email.
href="news://..." // Usenet newsgroup.
href="x-exec://..." // Executable program.
href="http://AnythingNotHere.com" // External links
Sample code:
$(document).on('click', 'a:not([target="_blank"])', function(){
var $this = $(this);
if ('some additional check of href'){
// Do ajax load and stop default behaviour
return false;
}
// allow link to work normally
});
Q:
Is there a way to easily detect all "local links" that would only navigate within the current website? excluding all the variations mentioned above.
Note: This is for an MVC 5 Razor website, so absolute site URLs are unlikely to occur.
I am using this pattern and matching a string.
String s = "//name:value /name:value";
if (s.matches("(//?\\s*\\w+:\\w+\\s*)+")) {
// it fits
}
This works properly.
But if I want to have a string like "/name-or-address:value/name-or-address:value" which has this '-' in second part, it doesn't work.
I am using \w to match A-Za-z_, but how can I include - in that?
Deal experts,
I am kinda new to this Regex thing.
When I was analyzing some codes, I frequently come across the pattern .+? or (.+?)
I can't seem to find the meaning of this pattern using my noobish deductive reasoning.
hi everybody...
I need a javascript code that split a string like below:
Input string: "a=aa| b=b||b | c=cc"
Output:
a=>aa
b=>b||b
c=>cc
I'd written different codes like:
split(/ \ | /)
or
Split(/ \| (?! \ |) /)
but didn't work.
please help me...
I really need it fast.
I need to replace a substring from some string. I've already created corrected code for doing it. But I amn't sure is it best way. Please, see code below:
var str = 'test ruby,ruby on rails,ruby,'
var substr = 'ruby';
var reg = new RegExp(',' + substr + ',|^' + substr + ',', 'gi');
str.replace(reg, ','); //returns "test ruby,ruby on rails,"
I'm trying to match the point between 2nd and 3rd paragraphs to insert some content. Paragraphs are delimited either by <p> or 2 newlines, mixed. Here's an example:
text text text text
text text text text
<p>
text text text text
text text text text
</p>
<--------------------------- want to insert text here
<p>
text text text text
text text text text
</p>
Hi,
What regular expressions do I need to extract section title(s) in a text file? So, in the following sample text, I'd like to extract
"Communication and Leadership"
"1.Self-Knowledge"
"2. Humility"
"(3) Clear Thinking".
Many thanks.
Communication and Leadership
True leaders understand that, rather
than forcing their followers into a
preconceived mold, their job is to
motivate and organize
followers to collectively accomplish
goals that are in everyone's
interests. The ability to communicate
this to co-workers and followers is
critical to the effectiveness of
leadership.
1.Self-Knowledge Superior leaders are able to devote their
skills and energies to leadership of a
group because they have worked through
personal issues to
the point where they know themselves
thoroughly. A high level of
self-knowledge is a prerequisite to
effective communication skills,
because
the things that you communicate as a
leader are coming from within.
2. Humility This subversion of personal preference requires a
certain level of humility. Although
popular definitions of leaders do not
always see
them as humble, the most effective
leaders actually are. This humility
may not be expressed in
self-effacement, but in a total
commitment to
the goals of the organization.
Humility requires an understanding of
one's own relative unimportance in
comparison to larger systems.
(3) Clear Thinking Clarity of thinking translates into clarity of
communication. A leader whose goals or
personal analysis is muddled will tend
to deliver
unclear or ambiguous directions to
followers, leading to confusion and
dissatisfaction. A leader with a clear
mind who is not ambivalent
about her purposes will communicate
what needs to be done in a
s traightforward and unmistakable
manner.
I want to develop a simple search engine, using ASP.NET and C# , where I can search for a word which contained in a very big text (like the Holy Bible or something like that), then the program shows the user where the word is.
I have no idea about in which database I can put this large text and using which method will I search for a word.
Any suggestions will help me, and if anyone have a tutorial for anything similar it will benefit me.
I have a comma delimited list I want to import into a database, and in some cases the last item is blank:
item1, item2, item3
item1, item2,
item1, item2,
I'd like to replace all of these empty columns with a placeholder value using a regexp
item1, item2, item3
item1, item2, PLACEHOLDER
item1, item2, PLACEHOLDER
I tried preg_replace("/,\n/", ",PLACEHOLDER\n",$csv);, but this isn't working. Anyone know what regexp would work for this?
I'm looking for a lightweight java reporting engine to be embedded in an applet application.
My first option was Jasper Reports, but the jar is over 2Mb, a little too heavy (and too bloated) for my needs. I don't know if there is modular jasper distribution, with funcionalities split in several jars (like html rendering, pdf, excel, compilation, runtime, etc).
I need to preview the report using Swing and print it. PDF export is a plus.
Hello,
i will like to capture a substring part of a text choosing the number of characters but if any word is cut then get until de last blank.
As example if this is the text:
"This is an example of text lorem ipsum, etc..."
and i would like to get for instance 12 characters that are: "This is an e". In this case example is cutted, then i would like to get "This is an".
Its possible do this with Regular Expressions?
Thanks in advance.
Jose
Hello all
<div id="a">
<div id="b">
Foo
</div>
<div id="m">
Bar
</div>
</div>
<div id="c">
Bar
</div>
I want find all object in id="a"
and out put is
<div id="a">
<div id="b">
Foo
</div>
<div id="m">
Bar
</div>
</div>
Geat thanks.
I have a very similar function is only one previous report and the other future, how can I optimize and write beautiful?
public bool AnyPreviousReportByGroup(int groupID)
{
if(this.GroupID == groupID)
{
return true;
}
else
{
return PreviousReport.AnyPreviousReportByGroup(groupID);
}
}
public bool AnyNextReportByGroup(int groupID)
{
if (this.GroupID == groupID)
{
return true;
}
else
{
return NextReport.AnyNextReportByGroup(groupID);
}
}
This is probably a really basic question, but I can't find any answers. I need to match a string by either one or more spaces OR an equals sign.
When I split this string: 9 x 13 = (8.9 x 13.4) (89 x 134)
with ( +) I get:
part 0: 9 x 13 = (8.9 x 13.4)
part 1: (89 x 134)
When I split it with (=) I get:
part 0: 9 x 13
part 1: (8.9 x 13.4) (89 x 134)
How can split by BOTH? Something like: (=)OR( +)
Edit:
This does not work(=)|( +)
Test it here: http://myregexp.com/ under "split".
"([\"'])(?:\\\\?+.)*?\\1"
I came up to this regexp to match all quoted strings..
It seems to work great...
The problem is how to match the text that isnt inside quotes..
The inverse -negative somehow...
I read the documentation and
(?!(([\"'])(?:\\\\?+.)*?\\1))
doesnt work
I need to be able to catch when the URL contains a image of multiple file types or follow this syntax.
http://localhost:8080/fdlic-web/webpic/101
Here is what i have so far.
(.*)(jpg|gif|png|bmp|jpeg|webpic/(\d+))$
I am trying to parse the MySQL data types returned by "DESCRIBE [TABLE]".
It returns strings like:
int(11)
float
varchar(200)
int(11) unsigned
float(6,2)
I've tried to do the job using regular expressions but it's not working.
PHP CODE:
$string = "int(11) numeric";
$regex = '/(\w+)\s*(\w+)/';
var_dump( preg_split($regex, $string) );
Hi, I have a situation.
I have been given some file name which can be like
<filename>YYYYMMDD<fileextension>
some valid file names that will satisfy the above pattern are as under
xxx20100326.xls,
xxx2v20100326.csv,
x_20100326.xls,
xy2z_abc_20100326_xyz.csv,
abc.xyz.20100326.doc,
ab2.v.20100326.doc,
abc.v.20100326_xyz.xls
In what ever be the above defined case, I need to pick up the dates only. So for all the cases, the output will be 20100326.
I am trying to achieve the same but no luck.
Here is what I have done so far
string testdata = "x2v20100326.csv";
string strYYYY = @"\d{4}";
string strMM = @"(1[0-2]|0[1-9])";
string strDD = @"(3[0-1]|[1-2][0-9]|0[1-9])";
string regExPattern = @"\A" + strYYYY + strMM + strDD + @"\Z";
Regex regex = new Regex(regExPattern);
Match match = regex.Match(testdata);
if (match.Success)
{
string result = match.Groups[0].Value;
}
I am using c#3.0 and dotnet framework 3.5
Please help. It is very urgent
Thanks in advance.
I have this HTTP Request and I want to display only the Authorization section (base64 Value) : any help ?
This Request is stored on a variable called hreq
I have tried this :
reg = re.search(r"Authorization:\sBasic\s(.*)\r", hreq)
print reg.group()
but doesn't work
Here is the request :
HTTP Request:
Path: /dynaform/custom.js
Http-Version: HTTP/1.1
Host: 192.168.1.254
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://domain.com/userRpm/StatusRpm.htm
Authorization: Basic YWhtEWa6MDfGcmVlc3R6bGH
I want to display the value YWhtEWa6MDfGcmVlc3R6bGH
Please I need your help
thanks in advance experts
What will be the exact definition of leap year? AFAIK "A year which is divisible by 4 is a leap year. But for century years' the years which are divisible by 400 is a leap year."
But that definition makes 100, 200, 300, 400.... upto 1700 NOT LEAP years! But in Gregorian calendar all of them are all leap year, check this out.
You can also try "call 1700" in Linux to verify.
So the correct algorithm for leap years would be:
if ( (year % 4 == 0) && ( year <= 1700 || year % 100 != 0 || year % 400 == 0 ))
printf("%d is a leap year.\n", year);
else
printf("%d is not a leap year.\n", year);
But is this specific to Gregorian calendar? Even if that is the case why is it not mentioned here?
Regards,
PS:The history of Gregorian callender seems interesting check out the September month of 1752.