[Flex 4.5.1] Regular Expressions - how to ignore case for cyrillic text /ignore flag doesn't work/ ?
The only solution to this that I've found is to convert the text to lowercase before matching...
Is there a more convenient way ?
Thanks
The only solution to this that I've found is to convert the text to lowercase before matching...
Is there a more convenient way ?
Thanks
Similar Messages
-
Regular expression in a switch case
Hey guys,
I have a string "52x + 60" and i want to extract 52x and 60 using regular expressions and a switch case
Is this the right way of doing it?
var equation:String = "32x + 5"
var numberExract:RegExp = /\d+/
var xExtract:RegExp = /d+/x/
for(var i:Number=0; i<equation.length; i++)
switch(equation.charAt(i))
case numberExtract.exec(equation):
trace("number");
break;
case xExtract.exec(equation):
trace("x");
break;
Because it's not tracing anything when i tryHere is a quick and dirty approach - can be customized, optimized and more elegant expressions used:
// equation
var string:String = "x^2 + 5x + 5 - x7 + 8 / 4";
// value replacing xs
var value:Number = 60;
// replace xs with value
// if x comes after digit
string = string.replace(/(?<=\d)x/g, String("*" + value));
// if x comes before digit
string = string.replace(/x(?=\d)/g, String(value + "*"));
// all other xs
string = string.replace(/x/g, String(value));
// remove spaces
string = string.replace(/\s/g, "");
// get pairs with first level math
var pattern:RegExp = /(\d+[\*\^\/]\d+)|\D|\d+/g;
var result:Number = stringToMath(string.match(pattern));
trace("result", result);
function stringToMath(match:Array):Number
// digits surrounding operator
var pattern:RegExp = /\d+\D\d+/;
for (var i:int = 0; i < match.length; i++)
if (match[i].match(pattern))
match[i] = String(calculate(match[i]));
trace("loop result", match);
return calculteSum(match);
* Calculates sums
* @param array
* @return
function calculteSum(array:Array):Number
var result:Number = array[0];
for (var i:int = 1; i < array.length - 1; i++)
if (array[i] == "+")
result += array[i + 1];
else if (array[i] == "-")
result -= array[i + 1];
return result;
* First level math
* @param string
* @return
function calculate(string:String):Number
var operator:RegExp = /[\+\*\/\^\-]/g;
var digits:Array = string.match(/\d+/g);
var num:Number = 0;
if (digits && string.match(operator) && digits.length > 1)
switch (string.match(operator)[0])
case "*":
num = digits[0] * digits[1];
break;
case "/":
num = digits[0] / digits[1];
break;
case "+":
num = digits[0] + digits[1];
break;
case "-":
num = digits[0] - digits[1];
break;
case "^":
num = Math.pow(digits[0], digits[1]);
break;
return num; -
I purchased a photo shop product called camera forge for $5.49 and is doesn't work. How do I get a refund? Thanks Fiona
Take it up with the app developer first. If they won't respond then you can take it up with iTunes support.
http://www.apple.com/support/itunes/contact/ -
HT1977 How do i get my money back for an app if it doesn't work?
How do i get my money back for an app if it doesn't work?
With every purchase you'll receive an email confirmatiom. There is a link: "Report Problem". Use it.
-
How to reset my iPod touch thats disabled it doesn't work even charging
How to reset my iPod touch thats disabled it doesn't work even charging
If the sleep/wake button doesn't work use the home button and if the home button doesn't work it's the other way around, however if both of them don't work charge it with your connector connected with your computer or wall socket and it will turn on. Hope this helps.
-
Regular expressions-how to replace [ and ] characters from a string
Hi,
my input String is "sdf938 [98033]". Now from this given string, i would like to replace the characters occurring within square brackets to empty string, including the square brackets too.
my output String needs to be "sdf938" in this case.. How should I do it using regular expressions? I tried several possible combinations but didn't get the expected results."\\s*\\[[^\\]]+\\]"
-
SQL Injection and Java Regular Expression: How to match words?
Dear friends,
I am handling sql injection attack to our application with java regular expression. I used it to match that if there are malicious characters or key words injected into the parameter value.
The denied characters and key words can be " ' ", " ; ", "insert", "delete" and so on. The expression I write is String pattern_str="('|;|insert|delete)+".
I know it is not correct. It could not be used to only match the whole word insert or delete. Each character in the two words can be matched and it is not what I want. Do you have any idea to only match the whole word?
Thanks,
Ricky
Edited by: Ricky Ru on 28/04/2011 02:29Avoid dynamic sql, avoid string concatenation and use bind variables and the risk is negligible.
-
Regular expression: how to match "[somestuff]"?
I have a problem with the following code.
I meant to catch "[fm1,-]". But I got "[fm1,-] funder [fm2,-] of our country. [sn8,s-]" instead.
import java.util.*;
import java.util.regex.*;
public class regPractice {
public static void main(String[] args) {
String s="<TITLE Getting to Know> I hope suitabe [fm1,-] funder [fm2,-] of our country. [sn8,s-]";
Pattern p=Pattern.compile("\\[(.*)\\]");
Matcher m=p.matcher(s);
if (m.find() ){
System.out.println(m.group(0) ) ;
}else{
System.out.println("Nothing");
}Regular expressions are greedy - that is (.*) will grab as much as it
possibly can before a ]. Hence you see what you see.
What you want is a reluctant quantifier, in this case (.*?)
These grab as little as they possibly can. The parentheses are also
not needed in your example, but you may want group(1) for some
other reason.
So we end up with:import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class regPractice {
public static void main(String[] args) {
String s = "<TITLE Getting to Know> I hope suitabe [fm1,-] funder [fm2,-] of our country. [sn8,s-]";
Pattern p = Pattern.compile("\\[(.*?)\\]");
Matcher m = p.matcher(s);
if (m.find()) {
System.out.println(m.group(0));
} else {
System.out.println("Nothing");
}which gives the desired output.
The different types of quantifier are described here:
http://java.sun.com/docs/books/tutorial/extra/regex/quant.html -
Regular expression - find if string does NOT contain text....
I have a string that I want to tokenize. The string can contain basically anything. I want to produce tokens for each "word" found, and for each "<=" or "," found. There does not need to be whitespace around a "<=" or a "," to consider it a token. So for example:
joe schmoe<=jack, jane
should become
joe
schmoe
<=
jack
jane
As a constraint, I do not want to use StringTokenizer at all, as "its use is discouraged in new code". http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html
Here's the code I plan on using for this:
public String[] getWords(String input) {
Matcher matcher = WORD_PATTERN.matcher(input);
ArrayList<String> words = new ArrayList<String>();
while (matcher.find()) {
words.add(matcher.group());
return (String[]) words.toArray(new String[0]);
}The trick, though, is coming up with a working regular expression. The closest I've found yet is:
([^\s]|^(,)|^(<=))+|,|<=
but that produces the following:
joe
schmoe<=jack,
jane
I think what I need is to be able to find if a string does not contain the substring "<=" or "," using a regular expression. Anyone know how to do this, or another way to do this using regular expressions?Try:
* Tokenizer.java
* version 1.0
* 01/06/2005
package samples;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
* @author notivago
public class StrangeTokenizer {
public static void main(String[] args) {
String text = "joe schmoe<=jack, jane";
Pattern pattern = Pattern.compile( "((?:<=)|(?:,)|(?:\\w+))");
Matcher matcher = pattern.matcher(text);
while( matcher.find() ) {
System.out.println( "Item: " + matcher.group(1) );
}May the code be with you. -
Regular expression to covert pascal case to underscores
I am looking for a way to use the SQL regular expression support to convert some pascal text into underscore separated words.
For example:
IsComplianceActionPossible -> Is_Compliance_Action_Possible.
What I am confused on is how to get the capital letter back in the output.
select regexp_replace('IsComplianceActionPossible','[A-Z]','_') from dual
REGEXP_REPLACE('ISCOMPLIAN
_s_ompliance_ction_ossibleI am know I am missing something simple. Any help is appreciated.
Regards, Tonyebrian wrote:
Another option:
SQL> select regexp_replace('IsComplianceActionPossible','(.)([A-Z])','\1_\2') from dual;
REGEXP_REPLACE('ISCOMPLIANCEA
Is_Compliance_Action_Possible
Most likely it would fit OP's needs, howvever it will not work on one letter words in the middle:
SQL> select regexp_replace('HereIAm','(.)([A-Z])','\1_\2') from dual
2 /
REGEXP_R
Here_IAm
SQL> select ltrim(regexp_replace('HereIAm','([A-Z])','_\1'),'_') from dual;
LTRIM(REG
Here_I_Am
SQL> SY. -
Regular expression help to solve sys_refcursor for a record
In reference to my thread Question on sys_refcursor with record type , I thought it can be solved differently. That is:
I have a string like '8:1706,1194,1817~1:1217,1613,1215,1250'
I need to do some manipulation using regular expressions and acheive some thing like
select * from <table> where
c1 in (8,1)
and c2 in (1706,1194,1817,1217,1613,1215,1250);Is it possible using regular expressions in a single select statement?Hi,
Clearance 6`- 8`` wrote:
Your understanding is absolutely correct. But unfortunately it did not work Frank.
SQL> SELECT COUNT (*)
2 FROM (SELECT sp.*
3 FROM spml sp, spml_assignment spag
4 WHERE sp.spml_id = spag.spml_id
5 AND spag.class_of_svc_id = 8
6 AND spag.service_type_id IN (1706, 1194, 1817)
7 AND spag.carrier_id = 4445
8 AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
9 AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
10 AND spag.unit_id = 5
11 AND sales_org_id = 1
12 UNION ALL
13 SELECT sp.*
14 FROM spml sp, spml_assignment spag
15 WHERE sp.spml_id = spag.spml_id
16 AND spag.class_of_svc_id = 1
17 AND spag.service_type_id IN (1217, 1613, 1215, 1250)
18 AND spag.carrier_id = 4445
19 AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
20 AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
21 AND spag.unit_id = 5
22 AND sales_org_id = 1);
COUNT(*)
88
SQL> SELECT COUNT (*)
2 FROM spml sp, spml_assignment spag
3 WHERE sp.spml_id = spag.spml_id
4 AND spag.carrier_id = 4445
5 AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
6 AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
7 AND spag.unit_id = 5
8 AND sales_org_id = 1
9 AND REGEXP_LIKE ('8:1706,1194,1817~1:1217,1613,1215,1250',
10 '(^|~)' || spag.class_of_svc_id || ':'
11 )
12 AND REGEXP_LIKE ('8:1706,1194,1817~1:1217,1613,1215,1250',
13 '(:|,)' || spag.service_type_id || '(,|$)'
14 );
COUNT(*)
140
SQL> Edited by: Clearance 6`- 8`` on Aug 11, 2009 8:04 PMJust serving what you ordered!
Originally, you said you were looking for something that produced the same result as
where c1 in (8, 1)
and c2 in (1706, 1194, 1817, 1217, 1613, 1215, 1250)that is, any of the c1s could be paired with any of the c2s.
Now it looks like what you want is
where ( c1 = 8
and c2 IN (1706, 1194, 1817)
or ( c1 = 1
and c2 IN (1217, 1613, 1215, 1250)
)that is, c1=8 and c2=1250 is no good; neither is c1=1 and c2=1706.
In that case, try
WHERE REGEXP_LIKE ( s
, '(^|~)' || c1
|| ':([0-9]+,)*'
|| c2
|| '(,|~|$)'
) -
How to trigger a MouseEvent from TLF, my test doesn't work
Hi,
I run into a problem while using the Listener of TLF,
Inside the TextFlow, I have several Paragraphs.
What I wish to accomplish is to trigger a mouse Event, like ROLL_OVER, ROLL_OUT event , when my mouse is over a on one of the Paragraphs.
I used to experiment a while , but never seem to work, just the examples below
_textFlow.addEventListener(FlowElementMouseEvent.ROLL_OUT,onMouseHandler);
_textFlow.addEventListener(FlowElementMouseEvent.ROLL_OVER,onMouseHandler);
/// which doesn't work. i need the event response ,so i can manipulate the paragraph
private function onMouseHandler(e:FlowElementMouseEvent):void
trace("onMouseHandler" + e.type );
var para:ParagraphElement = e.flowElement.getParagraph();
trace(para.textLength);
Thanks in advance!!!this is the code
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:Script>
<![CDATA[
import flash.display.Sprite;
import flash.events.MouseEvent;
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.conversion.TextConverter;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.events.*;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.InlineGraphicElement;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.elements.FlowElement;
import flashx.textLayout.tlf_internal;
private var _textFlow:TextFlow;
private var textSprite:Sprite;
private var backgroundSprite:Sprite;
var source:XML = <TextFlow xmlns="http://ns.adobe.com/textLayout/2008">
<div></div>
<p>
<img source="air.png"/>
<span>Flex is a highly productive, free open source framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops, and operating systems. While Flex applications can be built using only the free Flex SDK, developers can use Adobe® Flex® Builder™ 3 software to dramatically accelerate development. Try Flex Builder 3 free for 60 days. Try ILOG Elixir to enhance data display in your Flex applications.</span>
<br/>
</p>
<div></div>
<p>
<span>Adobe® Flex® 3 是用于构建和维护在所有主要浏览器、桌面和操作系统一致地部署的极具表现力的 Web 应用程序的高效率的开放源码框架。 可以使用免费的 Flex SDK 构建 Flex 应用程序, 开发人员可以使用 Adobe Flex Builder™ 3 软件来显著促进开发。 60 天内免费试用 Flex Builder 3</span>
<br/>
</p>
<div></div>
</TextFlow>;
private function init():void
backgroundSprite = new Sprite();
canvas.rawChildren.addChild(backgroundSprite);
textSprite = new Sprite();
canvas.rawChildren.addChild(textSprite);
_textFlow = TextConverter.importToFlow(source, TextConverter.TEXT_LAYOUT_FORMAT);
_textFlow.fontFamily = "Georgia, Times";
_textFlow.fontSize = 16;
_textFlow.columnCount = 2;
_textFlow.columnGap = 30;
_textFlow.columnWidth = 320;
setListenerOnParagraph(_textFlow);
_textFlow.flowComposer.addController(new ContainerController(textSprite,canvas.width,canvas.height));
_textFlow.flowComposer.updateAllControllers();
import flashx.textLayout.tlf_internal;
private function setListenerOnParagraph(textFlow:TextFlow):void
use namespace tlf_internal;
for(var i:int =0;i < textFlow.numChildren;i++)
var para2:FlowElement = textFlow.getChildAt(i);
if(para2 is ParagraphElement)
para2 = para2 as ParagraphElement
trace("paragraph:"+para2.textLength);
para2.tlf_internal::getEventMirror().addEventListener(MouseEvent.CLICK, regionClickHandler); // wrong here
public function regionClickHandler(evt:MouseEvent):void {
trace("click");
]]>
</mx:Script>
<mx:Canvas width="614" height="321" x="30" backgroundColor="#FDFBFB" id="canvas">
</mx:Canvas>
</mx:WindowedApplication> -
I purchased an App for 9.99 yesterday and it doesn't work. How do I get my money back?
Go to this site...
https://getsupport.apple.com/Issues.action
Report the issue to an Apple representative. -
InDesign CS6 how to set justification for form text field?
Hi everyone,
I've been playing with the ability to create form for PDF file but I haven't figure out how to set a center justification for a text field. By default it's left. Same thing for font, the one selected in InDesign while creating the form isn't used when editing the form in Acrobat.
Do I need to create a paragraph style with a specific name to preserve both attributes?
Thanks.InDesign CS6's forms features are great, but you're looking as version 1.0 of the feature. Those features cannot be set in InDesign.
Furthermore, if you try to pick a font other than the standard ones at the top of the menu, don't expect that your form users will be able to pick those fonts when they open up the form in Reader or Acrobat. I'm pretty sure that custom fonts are not stored in the PDF form. -
How can I cancel an email..cancel button doesn't work
I have a blank email open and cannot close it..cancel button doesn't work. How can I get rid of it
Sleep/Wake button
http://i1224.photobucket.com/albums/ee374/Diavonex/00bf6eae.jpg
Maybe you are looking for
-
AP - Controller connectivity issue
Hi, I am trying to connect a bunch of APs (1131) to a 4404 controller. The problem I have is that the APs, everytime I connect them to the local- to the controller- network they keep on rebooting. I have hardcoded the IP address of the APs, as well a
-
QuickTime 7.3.1 update not detected
QuickTime 7.3.1 has been out for a few days now, but it's not being detected by Apple Software Update, or the QuickTime control panel update feature. My QuickTime version still shows 7.3 (QuickTime Pro). Sounds like a bug in the update software... ha
-
Hi All, we have a to create a hierarchy for the below type. H1-->H2-->H3-->H5 -->H4 H1 | H2 | | H3 H4 | H5 How to create this type of hierarchy..? When we click on H1, H2 will display, when we click on H2, H3 and H4 should display, then clicking on H
-
I need help with my iphone 3gs?
-
How to open .app flash animation in mac and i os. can any one suggest.
I just published one flash animation with interactivity as .app file to open in mac and ios, but its not working. Kinldy any one please suggest the procedure to open the swf file in mac and ios. Thanks Dinesh