From wiki.ginstr.com
Jump to: navigation, search
m (formatting)
 
Line 3: Line 3:
 
[[Category:Action_Library]]
 
[[Category:Action_Library]]
  
;Description: Action is used to get <code>[[Datatypes#text|text]]</code> value which can be a substring or entire value from source and store it into to a target.
+
;Description: Action is used to get <code>[[Datatypes#text|text]]</code> value which can be a substring or entire value from [[source]] and store it into to a [[target]].
 
 
  
 
;Action returns: void
 
;Action returns: void
Line 18: Line 17:
 
|-
 
|-
 
| <code>source</code>
 
| <code>source</code>
| [[source]] source from which value will be used.
+
| [[source]] from which value will be used.
 
* Valid [[source]]:
 
* Valid [[source]]:
 
**<code>[[Datatypes#text|text]]</code>
 
**<code>[[Datatypes#text|text]]</code>
 
|-
 
|-
 
| <code>target</code>
 
| <code>target</code>
| [[target]] target to which "regexed" value will be stored.
+
| [[target]] to which "regexed" value will be stored.
 
* Valid [[target]]:
 
* Valid [[target]]:
 
**<code>[[Datatypes#text|text]]</code>
 
**<code>[[Datatypes#text|text]]</code>
Line 41: Line 40:
  
 
=====initial target value=====
 
=====initial target value=====
:<code>@variable/target</code> = <code></code>
+
::<code>@variable/target</code> = <code> </code>
  
 
=====variables.xml=====
 
=====variables.xml=====
Line 65: Line 64:
  
 
=====after action execution target=====
 
=====after action execution target=====
:<code>@variable/target</code> = <code>with some other stuff</code>
+
::<code>@variable/target</code> = <code>with some other stuff</code>
 +
 
 
<hr>
 
<hr>

Latest revision as of 17:02, 24 January 2018

gn:act_getTextByRegex

Description
Action is used to get text value which can be a substring or entire value from source and store it into to a target.
Action returns
void

Action signatures

[gn:act_getTextByRegex]|[source,target,regex]
[gn:act_getTextByRegex]|[source,target,regex,matchNumber]
Parameter Description
source source from which value will be used.
target target to which "regexed" value will be stored.
regex target Regular expression pattern which is used on source value to extract whole or part of text value.
(optional)
matchNumber
matchNumber number of match from which we want to extract text (in case there is more matches by regex pattern), by default first match will be returned (0) if this value is ommited. If number is bigger than count of matches that are returned null will be stored into target. If parameter is omitted value 0 is used.
  • Valid value:
    • Integer numerical value, i.e. 1, 2,...10

Example

initial target value
@variable/target =
variables.xml
<variable id="textualSourceValue" type="text" defaultValue="">this is my text|with some other stuff|and some more stuff|which needs to be stored into somewhere|soome as other |</variable>
<variable id="target" type="text" defaultValue=""></variable>
strings.xml
<string name="pattern">(.+?)\|</string>
screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_set="[gn:act_getTextByRegex]|[@variable/textualSourceValue,@variable/target,@string/pattern,1]" />
after action execution target
@variable/target = with some other stuff