<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Busquedas de palabras en textos con expresiones regulares</title>
	<atom:link href="http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/</link>
	<description>Blog de programación en ActionScript. Tips, tutoriales, ejemplos de Adobe Flash, Flex y AIR</description>
	<lastBuildDate>Wed, 28 Dec 2011 21:13:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Paul</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-15032</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Sun, 08 Aug 2010 01:35:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-15032</guid>
		<description>Ayuda porfa alguien sabe como puedo realizar una busqueda similar a la de google o la de encarta premium 2009, etc. en actionscript 3 que al momento de escribir una palbra te aparece ya una serie de opciones. gracias por la ayuda</description>
		<content:encoded><![CDATA[<p>Ayuda porfa alguien sabe como puedo realizar una busqueda similar a la de google o la de encarta premium 2009, etc. en actionscript 3 que al momento de escribir una palbra te aparece ya una serie de opciones. gracias por la ayuda</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tito</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14731</link>
		<dc:creator>Tito</dc:creator>
		<pubDate>Wed, 02 Jun 2010 22:16:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14731</guid>
		<description>Pues porque no sabía como escribirlo :)

Muchas gracias de nuevo, que la vida os lo pague con muchos intentos de hacer hijos

Gracias!</description>
		<content:encoded><![CDATA[<p>Pues porque no sabía como escribirlo <img src='http://www.codigoactionscript.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Muchas gracias de nuevo, que la vida os lo pague con muchos intentos de hacer hijos</p>
<p>Gracias!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14728</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Wed, 02 Jun 2010 16:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14728</guid>
		<description>@Tito:
¿Y por que no haces una función que te pase todo lo que se escriba a mayúsculas?
[as]miTexto.addEventListener(Event.CHANGE,toUpperCase);

function toUpperCase(e:Event):void
{
	miTexto.text = miTexto.text.toUpperCase();
}[/as]</description>
		<content:encoded><![CDATA[<p>@Tito:<br />
¿Y por que no haces una función que te pase todo lo que se escriba a mayúsculas?</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-1"><a href="#" onclick="javascript:showPlainTxt('actionscript-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-1">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">miTexto.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CHANGE</span>,<span style="color: #0066CC;">toUpperCase</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">toUpperCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; miTexto.<span style="color: #0066CC;">text</span> = miTexto.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">toUpperCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tito</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14727</link>
		<dc:creator>Tito</dc:creator>
		<pubDate>Wed, 02 Jun 2010 16:37:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14727</guid>
		<description>Hola de nuevo, otra duda que me surge y no he podido encontrar solucion por ningun sitio:

Aplico a un campo de introduccion de texto la propiedad .restric para que lo que escriba sea en mayusculas:

Asi solo se pueden introducir mayusculas, ni caracteres especiales ni numeros ni nada, sol mayusculas:
miTexto.text.restrict = (A-Z);

Y asi se puede introducir de todo menos minusculas que es lo que yo quiero:
miTexto.text.restrict = (^a-z);

El problema viene con la letra Ñ que no sale, ¿sabéis cómo hay que escribirlo o alguna forma de hacerlo?

Gracias</description>
		<content:encoded><![CDATA[<p>Hola de nuevo, otra duda que me surge y no he podido encontrar solucion por ningun sitio:</p>
<p>Aplico a un campo de introduccion de texto la propiedad .restric para que lo que escriba sea en mayusculas:</p>
<p>Asi solo se pueden introducir mayusculas, ni caracteres especiales ni numeros ni nada, sol mayusculas:<br />
miTexto.text.restrict = (A-Z);</p>
<p>Y asi se puede introducir de todo menos minusculas que es lo que yo quiero:<br />
miTexto.text.restrict = (^a-z);</p>
<p>El problema viene con la letra Ñ que no sale, ¿sabéis cómo hay que escribirlo o alguna forma de hacerlo?</p>
<p>Gracias</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tito</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14699</link>
		<dc:creator>Tito</dc:creator>
		<pubDate>Sun, 30 May 2010 17:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14699</guid>
		<description>Muchisimas gracias, ahora si me funciona y hubiese sido imposible haberlo conseguido por mi mismo que estoy demasiado verde aun

Gracias!</description>
		<content:encoded><![CDATA[<p>Muchisimas gracias, ahora si me funciona y hubiese sido imposible haberlo conseguido por mi mismo que estoy demasiado verde aun</p>
<p>Gracias!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zguillez</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14698</link>
		<dc:creator>zguillez</dc:creator>
		<pubDate>Sun, 30 May 2010 17:09:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14698</guid>
		<description>Mira, este código completo hace más o menos lo que quieres:
[as]var diccionarioString:String = &quot;&quot;;
var request:URLRequest = new URLRequest(&quot;diccionario.txt&quot;);
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE,onLoaderComplete);
loader.load(request);

function onLoaderComplete(e:Event):void
{
	diccionarioString = loader.data;
	loader.removeEventListener(Event.COMPLETE,onLoaderComplete);
	boton.addEventListener(MouseEvent.CLICK,onBotonHandler);
}

function onBotonHandler(e:MouseEvent):void
{
	var toSearch:String = textoabuscar.text;
	var search:RegExp = new RegExp(toSearch,&quot;gi&quot;);
	if (textoabuscar.text != &quot;&quot;)
	{
		if (search.test(diccionarioString))
		{
			salidabusqueda.text = &quot;Se encontró coincidancia&quot;;
		}
		else
		{
			salidabusqueda.text = &quot;No Se encontró coincidancia&quot;;
		}
	}
}[/as]</description>
		<content:encoded><![CDATA[<p>Mira, este código completo hace más o menos lo que quieres:</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-2"><a href="#" onclick="javascript:showPlainTxt('actionscript-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-2">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> diccionarioString:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">""</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> request:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"diccionario.txt"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> loader:URLLoader = <span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">loader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>,onLoaderComplete<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">loader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>request<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onLoaderComplete<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; diccionarioString = loader.<span style="color: #0066CC;">data</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; loader.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>,onLoaderComplete<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; boton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,onBotonHandler<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> onBotonHandler<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> toSearch:<span style="color: #0066CC;">String</span> = textoabuscar.<span style="color: #0066CC;">text</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> search:RegExp = <span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span>toSearch,<span style="color: #ff0000;">"gi"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>textoabuscar.<span style="color: #0066CC;">text</span> != <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>search.<span style="color: #006600;">test</span><span style="color: #66cc66;">&#40;</span>diccionarioString<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; salidabusqueda.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"Se encontró coincidancia"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; salidabusqueda.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"No Se encontró coincidancia"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tito</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14697</link>
		<dc:creator>Tito</dc:creator>
		<pubDate>Sun, 30 May 2010 09:52:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14697</guid>
		<description>Gracias por la informacion, pero me da errores y no se que falta o que sobra. Tengo:

- 1 boton con nombre de instancia &quot;boton&quot;
- 1 caja de introduccion de texto con nombre de instancia &quot;textoabuscar&quot;
- 1 texto dinamico con nombre de instancia &quot;salidabusqueda&quot;
- el archivo de texto llamado &quot;diccionario.txt&quot;

Y este es el código el cual me da errores y ya no se que poner ni que quitar:
------------------------
stop();
var request:URLRequest = new URLRequest(&quot;diccionario.txt&quot;); 
var loader:URLLoader = new URLLoader(); 
loader.load(request);

buscar.addEventListener(MouseEvent.CLICK, func_buscar);
function func_buscar(e:MouseEvent=null):void
{
	var textoabuscar:RegExp = new RegExp(&quot;(^&#124; )&quot; + textoabuscar.text + &quot;[\ .,]&quot;,&quot;gi&quot;);
	var busquedadetexto:Array = &quot;diccionario.txt&quot;.match(textoabuscar);
	salidabusqueda.text = &quot;Total: &quot; + busquedadetexto.length;
}
-----------------------
Que me falta por poner y por quitar? esto es desesperante.
Gracias de antemano</description>
		<content:encoded><![CDATA[<p>Gracias por la informacion, pero me da errores y no se que falta o que sobra. Tengo:</p>
<p>- 1 boton con nombre de instancia "boton"<br />
- 1 caja de introduccion de texto con nombre de instancia "textoabuscar"<br />
- 1 texto dinamico con nombre de instancia "salidabusqueda"<br />
- el archivo de texto llamado "diccionario.txt"</p>
<p>Y este es el código el cual me da errores y ya no se que poner ni que quitar:<br />
------------------------<br />
stop();<br />
var request:URLRequest = new URLRequest("diccionario.txt");<br />
var loader:URLLoader = new URLLoader();<br />
loader.load(request);</p>
<p>buscar.addEventListener(MouseEvent.CLICK, func_buscar);<br />
function func_buscar(e:MouseEvent=null):void<br />
{<br />
	var textoabuscar:RegExp = new RegExp("(^| )" + textoabuscar.text + "[\ .,]","gi");<br />
	var busquedadetexto:Array = "diccionario.txt".match(textoabuscar);<br />
	salidabusqueda.text = "Total: " + busquedadetexto.length;<br />
}<br />
-----------------------<br />
Que me falta por poner y por quitar? esto es desesperante.<br />
Gracias de antemano</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14696</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 30 May 2010 00:50:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14696</guid>
		<description>@Tito:

Para hacer esas comprobaciones tienes la función Test(). Sería algo así:

[as]
var miTexto:String = loader.data;

var toSearch:String = &quot;ANTENA&quot;;
var search:RegExp = new RegExp(toSearch,&quot;gi&quot;);

trace(search.test(miTexto));
[/as]

Te devolvería true o false según si encuentra la coincidencia.</description>
		<content:encoded><![CDATA[<p>@Tito:</p>
<p>Para hacer esas comprobaciones tienes la función Test(). Sería algo así:</p>
<div id="codigo">
<div class="igBar"><span id="lactionscript-3"><a href="#" onclick="javascript:showPlainTxt('actionscript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-3">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> miTexto:<span style="color: #0066CC;">String</span> = loader.<span style="color: #0066CC;">data</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> toSearch:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"ANTENA"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> search:RegExp = <span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span>toSearch,<span style="color: #ff0000;">"gi"</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>search.<span style="color: #006600;">test</span><span style="color: #66cc66;">&#40;</span>miTexto<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Te devolvería true o false según si encuentra la coincidencia.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tito</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-14695</link>
		<dc:creator>Tito</dc:creator>
		<pubDate>Sat, 29 May 2010 23:41:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-14695</guid>
		<description>Hola, estoy empezando en esto del ActionScript y ando bastante perdido, cada paso que doy me surgen más y más dudas :P
Veréis, estoy intentado hacer que un archivo flash cargue un archivo de texto externo el cual contiene una lista de palabras, eso creo que lo consigo con:

var request:URLRequest = new URLRequest(&quot;mitexto.txt&quot;); 
var loader:URLLoader = new URLLoader(); 
loader.load(request);

He de decir que la lista de palabras del archivo de texto está separada por INTROS y todas están en mayúsculas tal que así:

ANTE
ANTENA
ANTENISTA
BALA
BALAR
...

Ahora el problema viene en lo que quiero crear, es simplemente una caja de búsqueda en la cual consta de una caja de introducción de texto, un botón para buscar y un texto dinámico que me devuelva un mensaje diciendo si ha encontrado la palabra o no dentro de ese archivo de texto.

Seguro que es más fácil de lo que parece, pero no doy con ello. Te agradecería me ayudaras ya que veo por tu web y tutoriales dominas mucho ActionScript.

Gracias de antemano

Un saludo.</description>
		<content:encoded><![CDATA[<p>Hola, estoy empezando en esto del ActionScript y ando bastante perdido, cada paso que doy me surgen más y más dudas <img src='http://www.codigoactionscript.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
Veréis, estoy intentado hacer que un archivo flash cargue un archivo de texto externo el cual contiene una lista de palabras, eso creo que lo consigo con:</p>
<p>var request:URLRequest = new URLRequest("mitexto.txt");<br />
var loader:URLLoader = new URLLoader();<br />
loader.load(request);</p>
<p>He de decir que la lista de palabras del archivo de texto está separada por INTROS y todas están en mayúsculas tal que así:</p>
<p>ANTE<br />
ANTENA<br />
ANTENISTA<br />
BALA<br />
BALAR<br />
...</p>
<p>Ahora el problema viene en lo que quiero crear, es simplemente una caja de búsqueda en la cual consta de una caja de introducción de texto, un botón para buscar y un texto dinámico que me devuelva un mensaje diciendo si ha encontrado la palabra o no dentro de ese archivo de texto.</p>
<p>Seguro que es más fácil de lo que parece, pero no doy con ello. Te agradecería me ayudaras ya que veo por tu web y tutoriales dominas mucho ActionScript.</p>
<p>Gracias de antemano</p>
<p>Un saludo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marcos</title>
		<link>http://www.codigoactionscript.org/busquedas-de-palabras-en-textos-con-expresiones-regulares/comment-page-1/#comment-9112</link>
		<dc:creator>marcos</dc:creator>
		<pubDate>Tue, 19 May 2009 00:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.codigoactionscript.org/?p=318#comment-9112</guid>
		<description>Buenísimo, muy bien detallado, me servirá mucho, gracias</description>
		<content:encoded><![CDATA[<p>Buenísimo, muy bien detallado, me servirá mucho, gracias</p>
]]></content:encoded>
	</item>
</channel>
</rss>

